summaryrefslogtreecommitdiff
path: root/libc/stdio/vswprintf.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-04-09 22:22:28 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-04-09 22:22:28 +0000
commitc921d8a2c5cc4e31aad8f9c16fe8d8a7f3d9a4f9 (patch)
treedc5eacaa7a73ade8785dec398adf12bbaacadc64 /libc/stdio/vswprintf.c
parent18e006e1d2b88d00bc2c3314ba1c315fde8b055b (diff)
fix breakage in old_vfprintf case
Diffstat (limited to 'libc/stdio/vswprintf.c')
-rw-r--r--libc/stdio/vswprintf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/stdio/vswprintf.c b/libc/stdio/vswprintf.c
index f80bb5f64..59f7c2b57 100644
--- a/libc/stdio/vswprintf.c
+++ b/libc/stdio/vswprintf.c
@@ -11,6 +11,10 @@
libc_hidden_proto(vswprintf)
+#ifdef __USE_OLD_VFPRINTF__
+libc_hidden_proto(vfwprintf)
+#endif
+
#ifndef __STDIO_BUFFERS
#warning Skipping vswprintf since no buffering!
#else /* __STDIO_BUFFERS */
@@ -38,6 +42,10 @@ int vswprintf(wchar_t *__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)/sizeof(wchar_t))) {
@@ -50,7 +58,11 @@ int vswprintf(wchar_t *__restrict buf, size_t size,
__STDIO_STREAM_DISABLE_GETC(&f);
__STDIO_STREAM_DISABLE_PUTC(&f);
+#ifdef __USE_OLD_VFPRINTF__
+ rv = vfwprintf(&f, format, arg);
+#else
rv = _vfwprintf_internal(&f, format, arg);
+#endif
/* NOTE: Return behaviour differs from snprintf... */
if (f.__bufpos == f.__bufend) {