From 3d54adbe4752f3aaa61a1be412b6116ff7dd5be1 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Mon, 4 Jul 2011 01:01:58 -0400 Subject: [PATCH] printf("%#x",0) should print 0 not 0x0 --- src/stdio/vfprintf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index f13fbe10..2c4fdf3d 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -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); -- 2.25.1