strftime segfault vs return error code

Martin Sebor
Sun Sep 20 02:43:00 GMT 2015

> afaict, POSIX really only has this to say on the matter:

Both C and POSIX have the same text. In C, the text is in section The strftime function, paragraph 3:

   The appropriate characters are determined using the LC_TIME
   category of the current locale and by the values of zero or
   more members of the broken-down time structure pointed to by
   timeptr, as specified in brackets in the description. If any
   of the specified values are outside the normal range, the
   characters stored are unspecified.

This implies that the function is required to produce a valid
NUL-terminated string on output (assuming the output fits into
the provided buffer) and return the number of characters it


More information about the Libc-help mailing list