From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12659 invoked by alias); 12 Dec 2004 21:18:58 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 12624 invoked from network); 12 Dec 2004 21:18:54 -0000 Received: from unknown (HELO cgf.cx) (66.30.17.189) by sourceware.org with SMTP; 12 Dec 2004 21:18:54 -0000 Received: by cgf.cx (Postfix, from userid 201) id F218B1B401; Sun, 12 Dec 2004 16:19:48 -0500 (EST) Date: Sun, 12 Dec 2004 21:18:00 -0000 From: Christopher Faylor To: cygwin@cygwin.com Subject: Re: short fread(), but no ferror/feof Message-ID: <20041212211948.GA19741@trixie.casa.cgf.cx> Reply-To: cygwin@cygwin.com References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.1i X-SW-Source: 2004-12/txt/msg00398.txt.bz2 On Sat, Dec 11, 2004 at 11:32:07PM +0100, Peter Astrand wrote: >I've discussed this issue with some local gurus, and the consensus is >that fread() should do as many read() calls as it takes. This is what >glibc does, for example (if I understand the source correctly). >Basically, fread() means "read everything". It's just plain wrong to >return a partial result, unless EOF or an error occured. > >>Of course, Peter can always detect when this situation has occurred, >>precisely because fread() returns a value that, while >= 0, is < the >>number of elements requested, and when feof() and ferror() both return >>zero, his code could deduce that it's a short read from a pipe and try >>again. > >If you can convince the Python developers to add these checks to the >already-complicated fread() invocation in fileobject.c, I will stop >complaining... But fread() shouldn't behave like that. Perhaps you should prevail upon your gurus to provide a patch to fix this problem rather than relying on "complaining". cgf -- 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/