summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/vfprintf.c
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2016-08-27 10:00:36 +0000
committerache <ache@FreeBSD.org>2016-08-27 10:00:36 +0000
commitc75c3e9c541aa8bba4dedbbdd694bcb9aafd5e81 (patch)
tree8d272b2d5f945b483ed43a8308114e478103523b /lib/libc/stdio/vfprintf.c
parent82bfa7f4de819264453641e3d8bf043bf9ee4702 (diff)
downloadFreeBSD-src-c75c3e9c541aa8bba4dedbbdd694bcb9aafd5e81.zip
FreeBSD-src-c75c3e9c541aa8bba4dedbbdd694bcb9aafd5e81.tar.gz
MFC r304810
Don't check for __SERR which may stick from one of any previous stdio functions. __SERR is for user and the rest of stdio code do not check it for error sensing internally, only set it. In vf(w)printf.c here it is more easy to save __SERR, clear and restore it.
Diffstat (limited to 'lib/libc/stdio/vfprintf.c')
-rw-r--r--lib/libc/stdio/vfprintf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c
index e54e8ac..bf45bfb 100644
--- a/lib/libc/stdio/vfprintf.c
+++ b/lib/libc/stdio/vfprintf.c
@@ -364,6 +364,7 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
int nextarg; /* 1-based argument index */
va_list orgap; /* original argument pointer */
char *convbuf; /* wide to multibyte conversion result */
+ int savserr;
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -460,6 +461,9 @@ __vfprintf(FILE *fp, locale_t locale, const char *fmt0, va_list ap)
return (EOF);
}
+ savserr = fp->_flags & __SERR;
+ fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (char *)fmt0;
argtable = NULL;
@@ -1031,6 +1035,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+ else
+ fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);
OpenPOWER on IntegriCloud