This is the mail archive of the
mailing list for the newlib project.
Re: unbuffered fread() problem
- From: Jeff Johnston <jjohnstn at redhat dot com>
- To: Jason Tishler <jason at tishler dot net>
- Cc: Newlib List <newlib at sources dot redhat dot com>
- Date: Tue, 26 Oct 2004 14:22:15 -0400
- Subject: Re: unbuffered fread() problem
- References: <20041026140211.GA1280@tishler.net>
Thanks for catching this Jason. Patch checked in.
-- Jeff J.
Jason Tishler wrote:
While running the Cygwin Python 2.4b1 regression test, I uncovered a
newlib unbuffered fread() problem. The first attachment, ut.cc, is a
test case that demonstrates the issue:
$ echo -n 0 >/tmp/foo
ut /tmp/foo 1
count = 1023
buffer = (0$)
Hence, one can see that fread() in unbuffered mode always returns the
specified count instead of the number of elements actually read.
The second attachment is a "patch" that "fixes" the problem. I'm using
the words "patch" and "fixes" loosely because although the problem is
corrected, this may not be the best approach. Since I'm not that
familiar with newlib, I'm also concerned this patch may even cause other
unforeseen problems. Anyway, the patch should at least point one more
familiar with newlib to the specific part of the code that needs rework.