about summary refs log tree commit diff
path: root/src/stdio
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2016-09-16 17:40:08 -0400
committerRich Felker <dalias@aerifal.cx>2016-09-16 17:40:08 -0400
commit78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0 (patch)
treec56df8f2d5ba835a8e2e9789ef929a280a6adf90 /src/stdio
parente738b8cbe64b6dd3ed9f47b6d4cd7eb2c422b38d (diff)
downloadmusl-78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0.tar.gz
musl-78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0.tar.xz
musl-78897b0dc00b7cd5c29af5e0b7eebf2396d8dce0.zip
fix printf regression with alt-form octal, zero flag, and field width
commit b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1, in fixing another
issue, changed the logic for how alt-form octal adds the leading zero
to adjust the precision rather than using a prefix character. this
wrongly suppressed the zero flag by mimicing an explicit precision
given by the format string. switch back to using a prefix character.

based on bug report and patch by Dmitry V. Levin, but simplified.
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/vfprintf.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c
index 2ecf7692..e439a07a 100644
--- a/src/stdio/vfprintf.c
+++ b/src/stdio/vfprintf.c
@@ -570,7 +570,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
 			if (0) {
 		case 'o':
 			a = fmt_o(arg.i, z);
-			if ((fl&ALT_FORM) && p<z-a+1) p=z-a+1;
+			if ((fl&ALT_FORM) && p<z-a+1) prefix+=5, pl=1;
 			} if (0) {
 		case 'd': case 'i':
 			pl=1;