summaryrefslogtreecommitdiffstats
path: root/lib/libc
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2018-12-14 20:48:18 +0000
committermillert <millert@openbsd.org>2018-12-14 20:48:18 +0000
commit1129e9a8798f0aa2d7686e5bbd4fc8dae049e9d9 (patch)
tree50cbbd4889ae4692ff7292120e609ad2bdf95dcf /lib/libc
parentlet smtpd fatal on misbehaving proc filters (diff)
downloadwireguard-openbsd-1129e9a8798f0aa2d7686e5bbd4fc8dae049e9d9.tar.xz
wireguard-openbsd-1129e9a8798f0aa2d7686e5bbd4fc8dae049e9d9.zip
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.
Diffstat (limited to 'lib/libc')
-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;