This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: fdopen and errno
- To: Mark Kettenis <kettenis@wins.uva.nl>
- Subject: Re: fdopen and errno
- From: "Momchil 'Velco' Velikov" <velco@fadata.bg>
- Date: Sun, 04 Jul 1999 16:58:11 +0300
- CC: aj@arthur.rhein-neckar.de, libc-alpha@sourceware.cygnus.com, bennyb@ntplx.net
- Organization: fadata Ltd.
- References: <u8yagxamb5.fsf@arthur.rhein-neckar.de> <199907041303.PAA00221@delius.kettenis.nl>
- Reply-To: velco@fadata.bg
Mark Kettenis wrote:
> to indicate the error. Thus for Unix98 compatibility we should
> probably set errno. It looks as if we already detect EBADF and ENOMEM (I
> don't think we will ever encounter a condition that should generate
> EMFILE in glibc), and EINVAL in the case of a totally bogus mode
> specification. We should probably set errno to EINVAL as well if the
> stream mode doesn't match the access mode.
I'd suggest to set the errno to EBADF in order to be consistent
with other functions, which report an error on incompatible open mode.
Some of these functions are read(2) and write(2).
Also, stdio sets EBADF in this case.
IMHO, EINVAL is more applicable to bogus arguments, e.g. mode == "ix".
Regards,
-velco