bug-wget
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confusing "Success" error message


From: Andries E. Brouwer
Subject: Re: Confusing "Success" error message
Date: Fri, 8 Nov 2019 15:03:21 +0100
User-agent: Mutt/1.10.1 (2018-07-13)

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.

Andries



reply via email to

[Prev in Thread] Current Thread [Next in Thread]