July 31, 2016
9:09 a.m.
Russ Allbery wrote:
If you call a library function that is documented as setting errno, and it does not return an error, errno is undefined.
Yes, and this is a glitch in mktime's API: if mktime succeeds and returns (time_t)-1, errno might still be set. Although mktime's caller can detect whether (time_t)-1 represents an error by passing (time_t)-1 to localtime_r and comparing the resulting struct tm to the one that mktime returned, this is annoying.