diff options
Diffstat (limited to 'main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch')
-rw-r--r-- | main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch b/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch new file mode 100644 index 0000000000..c58122cfa5 --- /dev/null +++ b/main/musl/0007-fix-behavior-of-printf-with-alt-form-octal-zero-prec.patch @@ -0,0 +1,35 @@ +From b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Sat, 15 Nov 2014 12:16:19 -0500 +Subject: [PATCH] fix behavior of printf with alt-form octal, zero precision, + zero value + +in this case there are two conflicting rules in play: that an explicit +precision of zero with the value zero produces no output, and that the +'#' modifier for octal increases the precision sufficiently to yield a +leading zero. ISO C (7.19.6.1 paragraph 6 in C99+TC3) includes a +parenthetical remark to clarify that the precision-increasing behavior +takes precedence, but the corresponding text in POSIX off of which I +based the implementation is missing this remark. + +this issue was covered in WG14 DR#151. +--- + 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 ea25772..39c1e86 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) && arg.i) prefix+=5, pl=1; ++ if ((fl&ALT_FORM) && p<z-a+1) p=z-a+1; + } if (0) { + case 'd': case 'i': + pl=1; +-- +2.2.0 + |