summaryrefslogtreecommitdiff
path: root/libc/stdio/stdio.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdio/stdio.c')
-rw-r--r--libc/stdio/stdio.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libc/stdio/stdio.c b/libc/stdio/stdio.c
index d6c950fd0..34ee50347 100644
--- a/libc/stdio/stdio.c
+++ b/libc/stdio/stdio.c
@@ -420,6 +420,9 @@ off_t _uClibc_fread(unsigned char *buf, off_t bytes, FILE *fp)
fp->bufpos = fp->bufread = fp->bufstart; /* Reset pointers. */
fp->bufread += _uClibc_fread(fp->bufstart,
fp->bufend - fp->bufstart, fp);
+ if (fp->bufread - fp->bufstart >= bytes) { /* If we read all */
+ fp->mode |= ~__MODE_EOF; /* that was requested, make sure */
+ } /* EOF flag is clear. */
goto FROM_BUF;
}