This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


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

Re: [Gurusamy Sarathy <gsar@activestate.com>] ferror() after fread() on a FILE* opened for write


Andreas Jaeger <aj@arthur.rhein-neckar.de> writes:

|> >>>>> Ulrich Drepper writes:
|> 
|> Uli> hjl@lucon.org (H.J. Lu) writes:
|> >> This patch should pass the test. The problem is _IO_file_xsgetn
|> >> and _IO_XXX_file_xsputn may call read/write directly.
|> 
|> Uli> This is not necessary.  Don't add it.
|> 
|> Are you sure?  Check the current Posix draft of the Austin Group for
|> fread/fgetc and fwrite/fputc.  They explicitly mention EBADF for:
|>   
|>   The filedescriptor underlying stream is not a valid file descriptor
|>   open for reading (writing with fwrite/fputc).

If you use std{in,out,err} then the underlying fd _is_ valid for both
read and write (until you change that with freopen).

Andreas.

-- 
Andreas Schwab                                  "And now for something
schwab@suse.de                                   completely different."
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

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