Re: Reading a write-only file doesn't set error condition (was Re: Cygwin fread on Write-Only File Descriptor returns undefined state)

2006-06-14 Thread Corinna Vinschen
On Jun 14 09:19, Linda Walsh wrote: > Er, are you referring to the case of zero possibly being > a valid return value if the program requests zero bytes be read? > I didn't say "only 0"... I new about the other values but was focusing on the conditions that would exist only when > a 0 was return

Re: Reading a write-only file doesn't set error condition (was Re: Cygwin fread on Write-Only File Descriptor returns undefined state)

2006-06-14 Thread Linda Walsh
Corinna Vinschen wrote: In addition to fread not setting the error value, a value of zero is returned. Zero is to be returned, *only* on end-of-file or error. However, in the test case, neither That's not correct. Any value less than size*nitems indicates either EOF or an error. The

Reading a write-only file doesn't set error condition (was Re: Cygwin fread on Write-Only File Descriptor returns undefined state)

2006-06-14 Thread Corinna Vinschen
Thanks for the testcase. This looks like a small flaw in newlib. I redirected to the newlib list. On Jun 13 22:29, Linda Walsh wrote: > I think I've run into a problem involving fread. > I open a test file (fopen) with Write-Only access ("w"), > immediately after that, I do an fread on the file h

Cygwin fread on Write-Only File Descriptor returns undefined state

2006-06-13 Thread Linda Walsh
I think I've run into a problem involving fread. I open a test file (fopen) with Write-Only access ("w"), immediately after that, I do an fread on the file handle of some number of bytes. I expect fread to return an error. But it doesn't. It returns 0 as the number of bytes read, and the erro