From: hombre <hombre67@gmx.at>
To: musl@lists.openwall.com
Subject: fread, fwrite with size 0
Date: Wed, 3 Feb 2016 09:53:21 +0100 [thread overview]
Message-ID: <56B1C001.7020603@gmx.at> (raw)
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
next reply other threads:[~2016-02-03 8:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-03 8:53 hombre [this message]
2016-02-04 4:39 ` Rich Felker
2016-02-11 0:42 ` Rich Felker
2016-02-12 15:06 ` Rich Felker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=56B1C001.7020603@gmx.at \
--to=hombre67@gmx.at \
--cc=musl@lists.openwall.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).