summaryrefslogtreecommitdiff
path: root/src/stdio/vfwprintf.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-06-13 04:42:38 +0000
committerRich Felker <dalias@aerifal.cx>2015-06-13 04:42:38 +0000
commitf8f565df467c13248104223f99abf7f37cef7584 (patch)
treec2b4b927fc584f690b674b8ad9a7ecc8b9b5e01f /src/stdio/vfwprintf.c
parentf9e25d813860d53cd1e9b6145cc63375d2fe2529 (diff)
downloadmusl-f8f565df467c13248104223f99abf7f37cef7584.tar.gz
add printing of null %s arguments as "(null)" in wide printf
this is undefined, but supported in our implementation of the normal printf, so for consistency the wide variant should support it too.
Diffstat (limited to 'src/stdio/vfwprintf.c')
-rw-r--r--src/stdio/vfwprintf.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
index 281f4e56..deff9828 100644
--- a/src/stdio/vfwprintf.c
+++ b/src/stdio/vfwprintf.c
@@ -296,6 +296,7 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_
case 'm':
arg.p = strerror(errno);
case 's':
+ if (!arg.p) arg.p = "(null)";
bs = arg.p;
if (p<0) p = INT_MAX;
for (i=l=0; l<p && (i=mbtowc(&wc, bs, MB_LEN_MAX))>0; bs+=i, l++);