Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Date: Sun, 12 Dec 2004 16:19:48 -0500 From: Christopher Faylor To: cygwin AT cygwin DOT com Subject: Re: short fread(), but no ferror/feof Message-ID: <20041212211948.GA19741@trixie.casa.cgf.cx> Reply-To: cygwin AT cygwin DOT 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 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/