Re: [Exim] possible bug in exim-4.24

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Wakko Warner
Dátum:  
Címzett: Peter D. Gray
CC: exim-users
Tárgy: Re: [Exim] possible bug in exim-4.24
> >> It does not override the errno. It *pre-sets* the errno to zero,
> >> because strtoul does not set it in the case when it succeeds.


On linux:
RETURN VALUE
       The  strtoul()  function  returns either the result of the
       conversion or, if there was  a  leading  minus  sign,  the
       negation of the result of the conversion, unless the orig­
       inal (non-negated) value would  overflow;  in  the  latter
       case,  strtoul()  returns  ULONG_MAX  and  sets the global
       variable errno to ERANGE.


> > Actually, does any system call set errno if it succeeds? I've read
> > some man pages on linux calls and from what I can tell they only set
> > errno on error.


> Hang on, no system call/library routine
> should set errno if it succeeds. The
> value returned indicates if there was an error.
> IF an error is indicated by the return
> value then errno may be set.
>
> You should never look at errno unless the value returned
> by the system call indicated that it had an error.


I looked at read(2) on linux and from what I gather, it may set errno if it
read less than requested. I have not seen this happen myself. On solaris,
it does not set errno unless it returns -1. Ahh, the compatibility! =)

--
Lab tests show that use of micro$oft causes cancer in lab animals