This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [eric_backus@agilent.com] libc/1510: getc on /dev/null sets errno to 25
- To: drepper at cygnus dot com
- Subject: Re: [eric_backus@agilent.com] libc/1510: getc on /dev/null sets errno to 25
- From: Eric Backus <ericjb at labejb dot lsid dot hp dot com>
- Date: Wed, 05 Jan 2000 11:49:32 PST
- Cc: eric_backus at agilent dot com, schwab at suse dot de,libc-alpha at sourceware dot cygnus dot com
- Reply-To: eric_backus at agilent dot com
> Eric Backus <ericjb@labejb.lsid.hp.com> writes:
>
> > If GNU libc never modified errno unless there truly is an error to
> > report, it would be easier to use errno on GNU systems, though of
> > course such usage would be non-portable.
>
> Since it is unportable to rely on errno, why should we change it?
> Such a change only adds costs. Assigning to errno is not cheap.
> There is a hidden function call involved.
>
> Plus: there is a good reason why POSIX uses almost exclusively return
> values to signal errors. This is how it should have been done in the
> first place. errno is historic baggage we have to carry around but we
> don't want to make this even more expensive and also we don't want to
> encourage people using it.
These seem like reasonable reasons to leave the current behavior.
OK, thanks for considering this.
> > I note in the source code to GNU libc that there are other cases where
> > errno is saved and restored around certain operations.
>
> This happens only is a standard requires it or an interface is
> designed this way (e.g., in NSS).
I'm pretty sure I saw it inside some stdio functions. But it doesn't
really matter.
--
Eric Backus <eric_backus@agilent.com>
http://labejb.lsid.hp.com/
(425) 335-2495