diff options
Diffstat (limited to 'stdio-common')
-rw-r--r-- | stdio-common/vfprintf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/stdio-common/vfprintf.c b/stdio-common/vfprintf.c index 742213282f..a3aa252cd1 100644 --- a/stdio-common/vfprintf.c +++ b/stdio-common/vfprintf.c @@ -1115,9 +1115,10 @@ 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, len + 1, &mbstate); \ if (prec > 0 && prec < len) \ - len = prec; \ + len = __wcsrtombs (string, &s2, prec, &mbstate); \ + else \ + (void) __wcsrtombs (string, &s2, len + 1, &mbstate); \ } \ \ if ((width -= len) < 0) \ |