diff options
Diffstat (limited to 'libc/stdio')
-rw-r--r-- | libc/stdio/_scanf.c | 1 | ||||
-rw-r--r-- | libc/stdio/_vfprintf.c | 10 | ||||
-rw-r--r-- | libc/stdio/fwprintf.c | 1 |
3 files changed, 10 insertions, 2 deletions
diff --git a/libc/stdio/_scanf.c b/libc/stdio/_scanf.c index 1ad81cbe3..f38e72b5c 100644 --- a/libc/stdio/_scanf.c +++ b/libc/stdio/_scanf.c @@ -198,7 +198,6 @@ int vscanf(const char * __restrict format, va_list arg) { return vfscanf(stdin, format, arg); } -libc_hidden_def(vscanf) #endif /**********************************************************************/ diff --git a/libc/stdio/_vfprintf.c b/libc/stdio/_vfprintf.c index 3b007084d..3db8cdf67 100644 --- a/libc/stdio/_vfprintf.c +++ b/libc/stdio/_vfprintf.c @@ -417,6 +417,8 @@ extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) attribu /**********************************************************************/ #ifdef L_parse_printf_format +#ifdef __UCLIBC_HAS_GLIBC_CUSTOM_PRINTF__ + /* NOTE: This function differs from the glibc version in that parsing stops * upon encountering an invalid conversion specifier. Since this is the way * my printf functions work, I think it makes sense to do it that way here. @@ -485,6 +487,8 @@ size_t parse_printf_format(register const char *template, } #endif + +#endif /**********************************************************************/ #ifdef L__ppfs_init @@ -1670,6 +1674,9 @@ static int _do_one_spec(FILE * __restrict stream, #endif s = "(null)"; slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + slen = 0; } } else { /* char */ s = buf; @@ -1726,6 +1733,9 @@ static int _do_one_spec(FILE * __restrict stream, NULL_STRING: s = "(null)"; SLEN = slen = 6; + /* Use an empty string rather than truncation if precision is too small. */ + if (ppfs->info.prec >= 0 && ppfs->info.prec < slen) + SLEN = slen = 0; } } else { /* char */ *wbuf = btowc( (unsigned char)(*((const int *) *argptr)) ); diff --git a/libc/stdio/fwprintf.c b/libc/stdio/fwprintf.c index 2f2dddc10..954970867 100644 --- a/libc/stdio/fwprintf.c +++ b/libc/stdio/fwprintf.c @@ -21,4 +21,3 @@ int fwprintf(FILE * __restrict stream, const wchar_t * __restrict format, ...) return rv; } -libc_hidden_def(fwprintf) |