strftime segfault vs return error code
Martin Sebor
msebor@gmail.com
Sun Sep 20 02:43:00 GMT 2015
> afaict, POSIX really only has this to say on the matter:
> http://pubs.opengroup.org/onlinepubs/9699919799/functions/strftime.html
Both C and POSIX have the same text. In C, the text is in section
7.27.3.5 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
stored.
Martin
More information about the Libc-help
mailing list