This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH 0/3] Fix wrong assumption about errno


On 2017-12-22 08:57, Carlos O'Donell wrote:
> On 12/22/2017 08:39 AM, Zack Weinberg wrote:
> > Well, Carlos is right that it is _usually_ wrong to check errno to
> > decide if something failed.  Maybe something in the middle:
> > 
> > | The initial value of @code{errno} at program startup is zero.  In many
> > | cases, when a library function encounters an error, it will set
> > | @code{errno} to a non-zero value to indicate what specific error
> > | condition occurred.  The documentation for each function lists the
> > | error conditions that are possible for that function.  Not all library
> > | functions use this mechanism; some return an error code directly,
> > | instead.
> > |
> > | @strong{Warning:} Many library functions may set @code{errno} to some
> > | meaningless non-zero value even if they did not encounter any errors,
> > | and even if they return error codes directly.  Therefore, it is
> > | usually incorrect to check @emph{whether} an error occurred by
> > | inspecting the value of @code{errno}.  The proper way to check for
> > | error is documented for each function.
>  
> Zack, This language is better than what we have, thank you for that.

Indeed, thanks Zack.

> Aurelien, Are you able to merge this in to the manual?

I'll send a v2 with the above changes to the manual and with the changes
you suggested to the third patch.

Thanks,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]