summaryrefslogtreecommitdiff
path: root/stdio-common
diff options
context:
space:
mode:
Diffstat (limited to 'stdio-common')
-rw-r--r--stdio-common/vfprintf.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c
index dcc5cdbdaa..ef9165e448 100644
--- a/stdio-common/vfprintf.c
+++ b/stdio-common/vfprintf.c
@@ -890,8 +890,9 @@ vfprintf (FILE *s, const CHAR_T *format, va_list ap)
assert (__mbsinit (&mbstate)); \
s2 = (const wchar_t *) string; \
string = alloca (len + 1); \
- (void) __wcsrtombs (string, &s2, prec != -1 ? prec : UINT_MAX, \
- &mbstate); \
+ (void) __wcsrtombs (string, &s2, len + 1, &mbstate); \
+ if (prec < min) \
+ len = prec; \
} \
\
if ((width -= len) < 0) \