mirror of
https://github.com/fluencelabs/musl
synced 2025-07-01 15:42:05 +00:00
fix printf regression with alt-form octal, zero flag, and field width
commit b91cdbe2bc
, 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.
This commit is contained in:
@ -570,7 +570,7 @@ static int printf_core(FILE *f, const char *fmt, va_list *ap, union arg *nl_arg,
|
|||||||
if (0) {
|
if (0) {
|
||||||
case 'o':
|
case 'o':
|
||||||
a = fmt_o(arg.i, z);
|
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) {
|
} if (0) {
|
||||||
case 'd': case 'i':
|
case 'd': case 'i':
|
||||||
pl=1;
|
pl=1;
|
||||||
|
Reference in New Issue
Block a user