summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2018-12-14 20:48:19 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2018-12-14 20:48:19 +0000
commit7b18a5a4ceff0514de182c2a998068ede9c4b142 (patch)
tree867ae917a21848f05d1701f5c7f7dab389732131
parent48943501acf63b55c8b94c0d562b2eac85e5794d (diff)
Back out the optimization in rev 1.13, it does not update flags on
EOF or error. This caused a regression in the cPickle python extension.
-rw-r--r--lib/libc/stdio/fread.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/lib/libc/stdio/fread.c b/lib/libc/stdio/fread.c
index 33c558708d2..2abd2ac8dea 100644
--- a/lib/libc/stdio/fread.c
+++ b/lib/libc/stdio/fread.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fread.c,v 1.15 2016/09/21 04:38:56 guenther Exp $ */
+/* $OpenBSD: fread.c,v 1.16 2018/12/14 20:48:18 millert Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -68,21 +68,6 @@ fread(void *buf, size_t size, size_t count, FILE *fp)
fp->_r = 0;
total = resid;
p = buf;
-
- if ((fp->_flags & __SNBF) != 0) {
- /*
- * We know if we're unbuffered that our buffer is empty, so
- * we can just read directly. This is much faster than the
- * loop below which will perform a series of one byte reads.
- */
- while (resid > 0 && (r = (*fp->_read)(fp->_cookie, p, resid)) > 0) {
- p += r;
- resid -= r;
- }
- FUNLOCKFILE(fp);
- return ((total - resid) / size);
- }
-
while (resid > (r = fp->_r)) {
(void)memcpy(p, fp->_p, r);
fp->_p += r;