This is the mail archive of the libc-alpha@sourceware.cygnus.com 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]

Re: fdopen and errno


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

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