summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vfwprintf.c
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2016-08-25 17:13:04 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2016-08-25 17:13:04 +0000
commit1bf6c5f18b105f62a472f7b7a524ca66ed1fe573 (patch)
treebdce9410c86bf1c9fb82f166e6bcffd194bbf07b /lib/libc/stdio/vfwprintf.c
parent8905590ba9cf344059a10fd400cdcaf84c4f4f2c (diff)
Notes
Diffstat (limited to 'lib/libc/stdio/vfwprintf.c')
-rw-r--r--lib/libc/stdio/vfwprintf.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c
index b75c504b1e72..9a5381d54b9b 100644
--- a/lib/libc/stdio/vfwprintf.c
+++ b/lib/libc/stdio/vfwprintf.c
@@ -444,6 +444,7 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
int nextarg; /* 1-based argument index */
va_list orgap; /* original argument pointer */
wchar_t *convbuf; /* multibyte to wide conversion result */
+ int savserr;
static const char xdigs_lower[16] = "0123456789abcdef";
static const char xdigs_upper[16] = "0123456789ABCDEF";
@@ -536,6 +537,9 @@ __vfwprintf(FILE *fp, locale_t locale, const wchar_t *fmt0, va_list ap)
return (EOF);
}
+ savserr = fp->_flags & __SERR;
+ fp->_flags &= ~__SERR;
+
convbuf = NULL;
fmt = (wchar_t *)fmt0;
argtable = NULL;
@@ -1096,6 +1100,8 @@ error:
free(convbuf);
if (__sferror(fp))
ret = EOF;
+ else
+ fp->_flags |= savserr;
if ((argtable != NULL) && (argtable != statargtable))
free (argtable);
return (ret);