delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/06/14/12:19:39

X-Spam-Check-By: sourceware.org
Message-ID: <4490370B.7080609@tlinx.org>
Date: Wed, 14 Jun 2006 09:19:23 -0700
From: Linda Walsh <cygwin AT tlinx DOT org>
User-Agent: Thunderbird 1.5.0.4 (Windows/20060516)
MIME-Version: 1.0
To: newlib AT sourceware DOT org, cygwin AT cygwin DOT com
Subject: Re: Reading a write-only file doesn't set error condition (was Re: Cygwin fread on Write-Only File Descriptor returns undefined state)
References: <448F9EA1 DOT 7050908 AT tlinx DOT org> <20060614082441 DOT GA6326 AT calimero DOT vinschen DOT de>
In-Reply-To: <20060614082441.GA6326@calimero.vinschen.de>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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 programmer is responsible to test with feof() or
> ferror() to distinguish between these two cases.  See
>   
----
   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<count,
but was focusing on the conditions that would exist only when
a 0 was returned for the return value.

> I debugged your testcase and the problem appears to be in __srefill(),
> defined in newlib/libc/stdio/refill.c:
>   
....Cool! 

Linda


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019