Home | History | Annotate | Download | only in stdio
History log of /src/lib/libc/stdio/fread.3
RevisionDateAuthorComments
 1.16  01-Feb-2021  jdolecek for fread(3) and fwrite(3) check for (size * nmemb) size_t overflow, and
error out with EOVERFLOW if it happens; this is less silly answer
to a silly call than returning some randomly wrapped length

change adapted from OpenBSD

FreeBSD has a similar check, but they return EINVAL instead, feel
free to adjust if SUS or other standard mandates specific value

suggested by Kamil Rytarowski
 1.15  11-Sep-2011  jruoho .Xr for fsetpos(3), not .Fn.
 1.14  11-Jan-2009  christos merge christos-time_t
 1.13  19-Dec-2008  christos PR/9359: Chris Demetriou: Document fread/fwrite mixing behavior.
 1.12  07-Aug-2003  agc branches: 1.12.38; 1.12.40;
Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22280, verified by myself.
 1.11  16-Apr-2003  wiz Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
 1.10  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.9  07-Feb-2002  ross Generate <>& symbolically.
 1.8  25-Jan-2001  lukem branches: 1.8.2;
apparently ansi c only required fread(3) to return 0 if size or nmembs == 0.
however, susv2 adds the same to fwrite(3), so add the explicit check.
document this for both fread & fwrite. move diagassert for buf!=NULL to after
the (size * nmembs) == 0 check.

this has the helpful side effect of preventing the _DIAGASSERT()ion in
fwrite() being triggered by lots of 3rdparty code that calls fwrite() with
buf=NULL count=0
 1.7  29-Dec-2000  kleink Sprinkle some __restrict into stdio.
 1.6  05-Feb-1998  perry add LIBRARY section to man page
 1.5  02-Feb-1995  jtc Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
 1.4  04-Oct-1993  jtc fread and fwrite both return size_t, not int.
 1.3  01-Aug-1993  mycroft Add RCS indentifiers.
 1.2  22-Apr-1993  mycroft Fix various bugs in man pages (from 386BSD patch 130).
 1.1  21-Mar-1993  cgd branches: 1.1.1;
Initial revision
 1.1.1.2  02-Feb-1995  jtc imported from 44lite
 1.1.1.1  21-Mar-1993  cgd initial import of 386bsd-0.1 sources
 1.8.2.2  22-Mar-2002  nathanw Catch up to -current.
 1.8.2.1  08-Mar-2002  nathanw Catch up to -current.
 1.12.40.1  04-Jan-2009  christos merge with head.
 1.12.38.1  23-Dec-2008  snj Pull up following revision(s) (requested by christos in ticket #201):
lib/libc/stdio/fread.3: revision 1.13
PR/8359: Chris Demetriou: Document fread/fwrite mixing behavior.

RSS XML Feed