On 11/8/19 3:03 PM, Andries E. Brouwer wrote: > On Fri, Nov 08, 2019 at 09:55:48AM +0100, Tim Rühsen wrote: >> On 11/8/19 12:03 AM, Andries E. Brouwer wrote: > >>> The hope is probably that errno is the errno from gethttp. >>> But does time() preserve errno? >>> And does datetime_str() preserve errno? >>> It calls fmttime() which calls localtime() and strftime(). >> >> Libc functions only touch errno if there *is* an error > > Libc functions are free to call other functions internally, > and such internal calls may fail where the outer level call > does not fail. So even if a libc function does not return > an error, errno can have changed. > If it is needed later, errno should be saved immediately after a > failing system call. > > In this particular case I see > > % man localtime > ERRORS > EOVERFLOW > The result cannot be represented. > > so under unusual circumstances datetime_str() can change errno.
Sure it does - but never to 0 (Success). And that is what the OP is reporting. Regards, Tim
signature.asc
Description: OpenPGP digital signature
