X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fstdio%2Fvfprintf.c;h=b5001ff2bd05ab6599ca3763f0be27911f0022b9;hb=fe514951af4e67f05d17d796251af9a8229761eb;hp=67660121a71e3801319d7d0c4cea82f43c3ab1ee;hpb=cc44d9f2017855ad29c5c1301e8368158a4c2fa7;p=musl diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 67660121..b5001ff2 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -570,11 +570,11 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, case 'u': a = fmt_u(arg.i, z); } + if (p>=0) fl &= ~ZERO_PAD; if (!arg.i && !p) { a=z; break; } - if (p>=0) fl &= ~ZERO_PAD; p = MAX(p, z-a + !arg.i); break; case 'c': @@ -584,7 +584,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg, case 'm': if (1) a = strerror(errno); else case 's': - a = arg.p; + a = arg.p ? arg.p : "(null)"; z = memchr(a, 0, p); if (!z) z=a+p; else p=z-a;