printf("%#x",0) should print 0 not 0x0
authorRich Felker <dalias@aerifal.cx>
Mon, 4 Jul 2011 05:01:58 +0000 (01:01 -0400)
committerRich Felker <dalias@aerifal.cx>
Mon, 4 Jul 2011 05:01:58 +0000 (01:01 -0400)
src/stdio/vfprintf.c

index f13fbe10576d157684ecfc9d4e8bcf448010cd6d..2c4fdf3d48a920f90f06722f175b89a52ebeb8d3 100644 (file)
@@ -552,7 +552,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
                        fl |= ALT_FORM;
                case 'x': case 'X':
                        a = fmt_x(arg.i, z, t&32);
-                       if (fl & ALT_FORM) prefix+=(t>>4), pl=2;
+                       if (arg.i && (fl & ALT_FORM)) prefix+=(t>>4), pl=2;
                        if (0) {
                case 'o':
                        a = fmt_o(arg.i, z);