aboutsummaryrefslogtreecommitdiff
path: root/lib/libc/stdio/vsprintf.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/vsprintf.c')
-rw-r--r--lib/libc/stdio/vsprintf.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/stdio/vsprintf.c b/lib/libc/stdio/vsprintf.c
index 68a2f70469f4..23c18264fa50 100644
--- a/lib/libc/stdio/vsprintf.c
+++ b/lib/libc/stdio/vsprintf.c
@@ -37,27 +37,27 @@
* SUCH DAMAGE.
*/
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)vsprintf.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
-#include <sys/cdefs.h>
-#include <stdio.h>
+#include <errno.h>
#include <limits.h>
+#include <stdio.h>
#include "local.h"
#include "xlocale_private.h"
+#undef vsprintf /* _FORTIFY_SOURCE */
+
int
vsprintf_l(char * __restrict str, locale_t locale,
- const char * __restrict fmt, __va_list ap)
+ const char * __restrict fmt, __va_list ap)
{
- int ret;
FILE f = FAKE_FILE;
+ int serrno = errno;
+ int ret;
FIX_LOCALE(locale);
f._flags = __SWR | __SSTR;
f._bf._base = f._p = (unsigned char *)str;
f._bf._size = f._w = INT_MAX;
- ret = __vfprintf(&f, locale, fmt, ap);
+ ret = __vfprintf(&f, locale, serrno, fmt, ap);
*f._p = 0;
return (ret);
}