Another conformance question... This time fputs().

David Schultz das at FreeBSD.ORG
Wed Mar 3 21:35:36 PST 2004


On Wed, Mar 03, 2004, Jordan K. Hubbard wrote:
> 
> On Mar 3, 2004, at 8:15 AM, David Schultz wrote:
> 
> >One could argue that EBADF is a perfectly reasonable error code to
> >return in case (2) as well.  It is consistent with the way other
> >types of stdio streams work.  Specifically, if the stream isn't
> >writable (either because it was opened read-only and we don't have
> >permission or because it was opened without a writefn and we don't
> >support it) then we should get a single error code that reflects
> >the fact that the stream isn't writable.  The fputs(3) man page
> >even says:
> >
> >	[EBADF]		The _stream_ argument is not a writable stream.
> >
> >It doesn't say anything about why the stream is not writable.
> >Thus, there shouldn't be a problem with simply setting errno to
> >EBADF in all failure cases in __swsetup().
> 
> I agree.

Bruce doesn't seem to be happy with either this suggestion or the
status quo, but he did point out that fclose(), fflush(),
fpurge(), __fvwrite(), and __srefill() share this ``bug'' of
setting errno to EBADF.

> So, do you want to make the 2nd round of changes or shall I?

I'd be happy to do it, but I'm going to be out of town a lot this
month, so it might take me another three weeks if I can't find a
big enough FreeBSD timeslice in my schedule next week.  So if you
want it done *soon*, you should probably do it.  ;-)


More information about the freebsd-standards mailing list