On Fri, Nov 08, 2019 at 06:13:53PM +0200, Eli Zaretskii wrote:

>>>> 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.
>>> 
>>> That would be a bug in libc, I think.  Its functions should save and
>>> restore errno if other functions they call error out without causing
>>> the calling function to fail.
>> 
>> Here is the POSIX man page:
>> 
>> ...
>>  The  value  in  errno  is significant only when the return value of the
>>  call indicated an error (i.e., -1 from most system calls;  -1  or  NULL
>>  from  most  library  functions); a function that succeeds is allowed to
>>  change errno.
> 
> Thanks, but AFAIU this says the same as I did: if a function succeeds,
> it should not modify errno.

I think your understanding of the English language differs from mine.
Did you read the line "a function that succeeds is allowed to change errno"?

Reply via email to