This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib 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]

unbuffered fread() problem


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

-- 
PGP/GPG Key: http://www.tishler.net/jason/pubkey.asc or key servers
Fingerprint: 7A73 1405 7F2B E669 C19D  8784 1AFD E4CC ECF4 8EF6

Attachment: ut.cc
Description: Text document

Attachment: fread.c.diff
Description: Text document


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