return (0) if size or count == 0 before check for _DIAGASSERT(buf != NULL).
this is ok according to SUS.
This commit is contained in:
parent
db2b0adebd
commit
3471ac6647
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fread.c,v 1.10 1999/09/16 11:45:27 lukem Exp $ */
|
||||
/* $NetBSD: fread.c,v 1.11 1999/09/16 12:45:34 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -41,7 +41,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) 12/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fread.c,v 1.10 1999/09/16 11:45:27 lukem Exp $");
|
||||
__RCSID("$NetBSD: fread.c,v 1.11 1999/09/16 12:45:34 lukem Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -63,6 +63,8 @@ fread(buf, size, count, fp)
|
|||
int r;
|
||||
size_t total;
|
||||
|
||||
if (size == 0 || count == 0) /* check first, according to SUS */
|
||||
return (0);
|
||||
_DIAGASSERT(buf != NULL);
|
||||
_DIAGASSERT(fp != NULL);
|
||||
#ifdef _DIAGNOSTIC
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fwrite.c,v 1.9 1999/09/16 11:45:28 lukem Exp $ */
|
||||
/* $NetBSD: fwrite.c,v 1.10 1999/09/16 12:45:34 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1990, 1993
|
||||
|
@ -41,7 +41,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fwrite.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: fwrite.c,v 1.9 1999/09/16 11:45:28 lukem Exp $");
|
||||
__RCSID("$NetBSD: fwrite.c,v 1.10 1999/09/16 12:45:34 lukem Exp $");
|
||||
#endif
|
||||
#endif /* LIBC_SCCS and not lint */
|
||||
|
||||
|
@ -66,6 +66,8 @@ fwrite(buf, size, count, fp)
|
|||
struct __suio uio;
|
||||
struct __siov iov;
|
||||
|
||||
if (size == 0 || count == 0) /* check first, according to SUS */
|
||||
return (0);
|
||||
_DIAGASSERT(buf != NULL);
|
||||
_DIAGASSERT(fp != NULL);
|
||||
#ifdef _DIAGNOSTIC
|
||||
|
@ -77,8 +79,6 @@ fwrite(buf, size, count, fp)
|
|||
errno = EBADF;
|
||||
return (0);
|
||||
}
|
||||
if (count == 0)
|
||||
return (0);
|
||||
#endif
|
||||
|
||||
/* LINTED we don't play with buf */
|
||||
|
|
Loading…
Reference in New Issue