summaryrefslogtreecommitdiffstats
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/stdio/fread.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libc/stdio/fread.c b/libc/stdio/fread.c
index baf62b9..bac8dad 100644
--- a/libc/stdio/fread.c
+++ b/libc/stdio/fread.c
@@ -120,7 +120,7 @@ fread(void *buf, size_t size, size_t count, FILE *fp)
while (total > 0) {
ssize_t bytes_read = (*fp->_read)(fp->_cookie, dst, total);
if (bytes_read <= 0) {
- fp->_flags = (fp->_r == 0) ? __SEOF : __SERR;
+ fp->_flags |= (bytes_read == 0) ? __SEOF : __SERR;
break;
}
dst += bytes_read;