summaryrefslogtreecommitdiff
path: root/libc/stdio/vsnprintf.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-10 20:39:07 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-10 20:39:07 +0000
commit2a915734a32c5aec9a6a76c13bcb074d30e64171 (patch)
tree8b5ac7073c8bf4bb6f150e33f3ebcdb07bf8beea /libc/stdio/vsnprintf.c
parentc921d8a2c5cc4e31aad8f9c16fe8d8a7f3d9a4f9 (diff)
even more fixes for vda-made breakage in vXXXfprintf
(pointed out by Peter S.Mazinger)
Diffstat (limited to 'libc/stdio/vsnprintf.c')
-rw-r--r--libc/stdio/vsnprintf.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libc/stdio/vsnprintf.c b/libc/stdio/vsnprintf.c
index b54d54d20..e5a14d51a 100644
--- a/libc/stdio/vsnprintf.c
+++ b/libc/stdio/vsnprintf.c
@@ -19,8 +19,7 @@ libc_hidden_proto(vfprintf)
#endif /* __UCLIBC_MJN3_ONLY__ */
#ifdef __STDIO_BUFFERS
-
-/* NB: __USE_OLD_VFPRINTF__ is not defined in this case */
+/* NB: we can still have __USE_OLD_VFPRINTF__ defined in this case! */
int vsnprintf(char *__restrict buf, size_t size,
const char * __restrict format, va_list arg)
@@ -47,6 +46,10 @@ int vsnprintf(char *__restrict buf, size_t size,
__INIT_MBSTATE(&(f.__state));
#endif /* __STDIO_MBSTATE */
+#if defined(__USE_OLD_VFPRINTF__) && defined(__UCLIBC_HAS_THREADS__)
+ f.__user_locking = 1; /* Set user locking. */
+ __stdio_init_mutex(&f.__lock);
+#endif
f.__nextopen = NULL;
if (size > SIZE_MAX - (size_t) buf) {
@@ -62,7 +65,11 @@ int vsnprintf(char *__restrict buf, size_t size,
__STDIO_STREAM_DISABLE_GETC(&f);
__STDIO_STREAM_ENABLE_PUTC(&f);
+#ifdef __USE_OLD_VFPRINTF__
+ rv = vfprintf(&f, format, arg);
+#else
rv = _vfprintf_internal(&f, format, arg);
+#endif
if (size) {
if (f.__bufpos == f.__bufend) {
--f.__bufpos;