projects
/
oweals
/
musl.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f9e25d8
)
add printing of null %s arguments as "(null)" in wide printf
author
Rich Felker
<dalias@aerifal.cx>
Sat, 13 Jun 2015 04:42:38 +0000
(
04:42
+0000)
committer
Rich Felker
<dalias@aerifal.cx>
Sat, 13 Jun 2015 04:42:38 +0000
(
04:42
+0000)
this is undefined, but supported in our implementation of the normal
printf, so for consistency the wide variant should support it too.
src/stdio/vfwprintf.c
patch
|
blob
|
history
diff --git
a/src/stdio/vfwprintf.c
b/src/stdio/vfwprintf.c
index 281f4e569170afb0aa8dbaf2b38ca31e7bdab2a6..deff9828e745acbe88db143ec9d3718a00f7c30d 100644
(file)
--- 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++);