Commit Graph

13 Commits

Author SHA1 Message Date
lukem fa11ebb133 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
2001-01-25 02:06:25 +00:00
lukem d896261208 back out the #ifdef _DIAGNOSTIC argument checks; too many people complained.
_DIAGASSERT() is still retained.
1999-09-20 04:38:56 +00:00
lukem e0f82c3ae3 revert previous; if we examine SUS more closely we find that unless explictly specified, use of a NULL pointer is undefined 1999-09-17 13:03:46 +00:00
lukem 3471ac6647 return (0) if size or count == 0 before check for _DIAGASSERT(buf != NULL).
this is ok according to SUS.
1999-09-16 12:45:34 +00:00
lukem b48252f365 * 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
1999-09-16 11:44:54 +00:00
christos e7f7fdba9a delint 1998-11-15 17:19:53 +00:00
jtc da2013ac86 Use FLOCKFILE() and FUNLOCKFILE() macros from reentrant.h so that stdio
can be made thread-safe.
1998-01-19 07:38:41 +00:00
christos 23312f88d4 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.
1997-07-13 20:14:49 +00:00
jtc 255db7b26b Merged with 4.4lite.
Changed to conform to NetBSD's new RCS Id convention.
1995-02-02 02:09:03 +00:00
jtc 75e26868bb fread and fwrite both return size_t, not int. 1993-10-04 18:50:23 +00:00
jtc 9c20f740a3 Declare rcsid strings so they are stored in text segment. 1993-08-26 00:43:03 +00:00
mycroft e9d867ef50 Add RCS identifiers. 1993-08-01 17:54:45 +00:00
cgd 61f282557f initial import of 386bsd-0.1 sources 1993-03-21 09:45:37 +00:00