unbuffered fread() problem

Jeff Johnston jjohnstn@redhat.com
Wed Oct 27 09:21:00 GMT 2004


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.
> 
> Thanks,
> Jason
> 



More information about the Newlib mailing list