diff options
author | 2009-07-12 18:45:21 +0000 | |
---|---|---|
committer | 2009-07-12 18:45:21 +0000 | |
commit | a6d7aecd3cf6f368005489220a4e67c63db49a69 (patch) | |
tree | 19eb6ea4770d2625593849a0a92517221e0f27e0 /lib/libc/stdio/fread.c | |
parent | sync to 1.7.23: second step to get rid of enum mdoc_warn: (diff) | |
download | wireguard-openbsd-a6d7aecd3cf6f368005489220a4e67c63db49a69.tar.xz wireguard-openbsd-a6d7aecd3cf6f368005489220a4e67c63db49a69.zip |
fwrite() should also return 0 if either size or nmemb are 0.
Adapted from FreeBSD. OK deraadt@
Diffstat (limited to 'lib/libc/stdio/fread.c')
-rw-r--r-- | lib/libc/stdio/fread.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c index 62906216d8b..c7389e76ed6 100644 --- a/lib/libc/stdio/fread.c +++ b/lib/libc/stdio/fread.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fread.c,v 1.6 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: fread.c,v 1.7 2009/07/12 18:45:21 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -44,9 +44,7 @@ fread(void *buf, size_t size, size_t count, FILE *fp) size_t total; /* - * The ANSI standard requires a return value of 0 for a count - * or a size of 0. Peculiarily, it imposes no such requirements - * on fwrite; it only requires fread to be broken. + * ANSI and SUSv2 require a return value of 0 if size or count are 0. */ if ((resid = count * size) == 0) return (0); |