SCCS-vsn: lib/libc/stdio/fread.c 8.2
*/
#if defined(LIBC_SCCS) && !defined(lint)
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)fread.c 8.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)fread.c 8.2 (Berkeley) %G%";
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
#endif /* LIBC_SCCS and not lint */
#include <stdio.h>
register int r;
size_t total;
register int r;
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.
+ */
if ((resid = count * size) == 0)
if ((resid = count * size) == 0)
if (fp->_r < 0)
fp->_r = 0;
total = resid;
if (fp->_r < 0)
fp->_r = 0;
total = resid;