Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Wed, 3 Feb 2016 09:53:21 +0100
From: hombre <hombre67@....at>
To: musl@...ts.openwall.com
Subject: fread, fwrite with size 0

Hello,

I think that fread and fwrite does not return 0 when parameter size is 0 
(when nmemb is 0, it does).
Clib spec says: If size or nmemb is zero, fread/fwrite returns zero

I did the following changes to make it work:

fread:
from
     return nmemb;
to
     return len == 0 ? 0 : nmemb;

fwrite:
from
     return k == l ? nmemb : k / size;
to
     if (l == 0)
         return 0;
     else
         return k == l ? nmemb : k / size;

Regards,
Erwin

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.