History log of /src/lib/libc/stdio/fwrite.c |
Revision | | Date | Author | Comments |
1.19 |
| 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.18 |
| 04-Feb-2018 |
mrg | fixes for GCC 6:
- -Wstrict-prototypes is not available for C++, so don't try to ignore it for C++. - remove many _DIAGASSERT() checks against not NULL for functions with arguments with nonnull attributes. in two cases, leave code behind that should set defaults to "(null)". - use -Wno-error=frame-address for i386 mcount, as it seems valid to assume the caller will have a frame.fair
|
1.17 |
| 15-Mar-2012 |
christos | - ansify, knf. - no functional changes
|
1.16 |
| 29-Nov-2005 |
christos | branches: 1.16.44; WARNS=4
|
1.15 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
|
1.14 |
| 18-Jan-2003 |
thorpej | Merge the nathanw_sa branch.
|
1.13 |
| 25-Jan-2001 |
lukem | branches: 1.13.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.12 |
| 20-Sep-1999 |
lukem | back out the #ifdef _DIAGNOSTIC argument checks; too many people complained. _DIAGASSERT() is still retained.
|
1.11 |
| 17-Sep-1999 |
lukem | revert previous; if we examine SUS more closely we find that unless explictly specified, use of a NULL pointer is undefined
|
1.10 |
| 16-Sep-1999 |
lukem | return (0) if size or count == 0 before check for _DIAGASSERT(buf != NULL). this is ok according to SUS.
|
1.9 |
| 16-Sep-1999 |
lukem | * use _DIAGASSERT() to check pointer arguments against NULL and file descriptors against -1 (as appropriate). * add actual checks which to detect stuff that would trigger_DIAGASSERT(), and attempt to return a sane error condition. * knf some code * remove some `register' decls.
the first two items result in the addition of code similar to the following in various functions:
_DIAGASSERT(path != NULL) #ifdef _DIAGNOSTIC if (path == NULL) { errno = EFAULT; return (-1); } #endif
|
1.8 |
| 15-Nov-1998 |
christos | delint
|
1.7 |
| 19-Jan-1998 |
jtc | Use FLOCKFILE() and FUNLOCKFILE() macros from reentrant.h so that stdio can be made thread-safe.
|
1.6 |
| 13-Jul-1997 |
christos | Fix RCSID's Fix gcc warnings. Add prototypes for functions that were declared in more than one place to local.h or extern.h and use that instead.
|
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 |
| 26-Aug-1993 |
jtc | Declare rcsid strings so they are stored in text segment.
|
1.2 |
| 01-Aug-1993 |
mycroft | Add RCS identifiers.
|
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.13.2.1 |
| 06-Feb-2002 |
nathanw | #include "reentrant.h" before "local.h" so that the thread types used in fileext.h are avaliable.
|
1.16.44.1 |
| 17-Apr-2012 |
yamt | sync with head
|