fix behavior of printf with alt-form octal, zero precision, zero value
authorRich Felker <dalias@aerifal.cx>
Sat, 15 Nov 2014 17:16:19 +0000 (12:16 -0500)
committerRich Felker <dalias@aerifal.cx>
Mon, 30 Mar 2015 05:41:32 +0000 (01:41 -0400)
commit395e409cc0b89faeaae8d701a18105d020f7aade
treed7b99cc1c4e54ef75aa1ca64de5f1d8b2a651286
parent8c245bf2725f3171ee8f58dab7169e5d682de026
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.

(cherry picked from commit b91cdbe2bc8b626aa04dc6e3e84345accf34e4b1)
src/stdio/vfprintf.c