aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vsnprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vsnprintf.c')
-rw-r--r--lib/libc/stdio/vsnprintf.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/stdio/vsnprintf.c b/lib/libc/stdio/vsnprintf.c
index 2213b20e3f1e..45e4fb529be7 100644
--- a/lib/libc/stdio/vsnprintf.c
+++ b/lib/libc/stdio/vsnprintf.c
@@ -43,14 +43,17 @@
#include "local.h"
#include "xlocale_private.h"
+#undef vsnprintf /* _FORTIFY_SOURCE */
+
int
vsnprintf_l(char * __restrict str, size_t n, locale_t locale,
- const char * __restrict fmt, __va_list ap)
+ const char * __restrict fmt, __va_list ap)
{
+ FILE f = FAKE_FILE;
size_t on;
+ int serrno = errno;
int ret;
char dummy[2];
- FILE f = FAKE_FILE;
FIX_LOCALE(locale);
on = n;
@@ -71,7 +74,7 @@ vsnprintf_l(char * __restrict str, size_t n, locale_t locale,
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._w = n;
- ret = __vfprintf(&f, locale, fmt, ap);
+ ret = __vfprintf(&f, locale, serrno, fmt, ap);
if (on > 0)
*f._p = '\0';
return (ret);