This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: short fread(), but no ferror/feof

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
>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".


Unsubscribe info:
Problem reports:

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