This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: strftime segfault vs return error code
- From: Martin Sebor <msebor at gmail dot com>
- To: OndÅej BÃlka <neleai at seznam dot cz>, Adam Nielsen <a dot nielsen at shikadi dot net>, libc-help at sourceware dot org
- Date: Sat, 19 Sep 2015 20:43:41 -0600
- Subject: Re: strftime segfault vs return error code
- Authentication-results: sourceware.org; auth=none
- References: <20150712163423 dot 5bb57dd1 at korath dot teln dot shikadi dot net> <20150712070745 dot GA1625 at domone> <20150728033725 dot GD21252 at vapier>
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