On Tue, Jun 30, 2015 at 1:05 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Answering myself to my earlier question, the reason is because I was > worried what happens when given fmt is a malformed strftime format > specifier. Perhaps it ends with a lone % and "% " may format to > something unexpected, or something. That's a good point. I had considered prepending the extra character (space) rather than appending it but eventually rejected it to avoid the expense of shifting the characters down by one before returning the formatted string. However, is it our responsibility to guard against a malformed format? POSIX doesn't state the behavior of "% ", so I don't think we are any worse off by appending space to a malformed format ending with "%" since the malformed format could wreak havoc even without our transformation. > Are we checking an error from strftime(3)? According to the "BUGS" section in POSIX: If the output string would exceed max bytes, errno is not set. This makes it impossible to distinguish this error case from cases where the format string legitimately produces a zero-length output string. POSIX.1-2001 does not specify any errno settings for strftime(). So, there does not seem to be a point in checking 'errno'. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html