This is the mail archive of the
libc-alpha@sourceware.cygnus.com
mailing list for the glibc project.
Re: [Gurusamy Sarathy <gsar@activestate.com>] ferror() after fread() on a FILE* opened for write
- To: libc-alpha Mailinglist <libc-alpha@sourceware.cygnus.com>
- Subject: Re: [Gurusamy Sarathy <gsar@activestate.com>] ferror() after fread() on a FILE* opened for write
- From: Andreas Schwab <schwab@suse.de>
- Date: 21 Jul 1999 09:56:55 +0200
- Cc: gsar@activestate.com
- References: <u87lnumrqp.fsf@arthur.rhein-neckar.de>
Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:
|> Looking at the appended bug report, I guess we should check for
|> if (fp->_flags & _IO_NO_WRITES)
|>
|> in the fread implementation. But what's the right place and who
|> exactly should we change it?
I cannot find anything in the standard that requires setting the error
indicator when writing to a read-only stream or reading from a write-only
stream. Currently we only check _IO_NO_{READS,WRITES} in the underflow
and overflow methods, so that getc/putc will fail (but getc doesn't set
the error indicator yet; I'm fixing that). Neither xsgetn nor xsputn do
any explicit checking, so they will fail only if the underlying descriptor
is truely write-only or read-only, resp. (but the standard descriptors are
read/write).
Andreas.
--
Andreas Schwab "And now for something
schwab@suse.de completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg