Browse Source

Ok... the fix wasn't quite so straightforward. Hopefully this will do it.

Manuel Novoa III 24 years ago
parent
commit
75f21a11e1
1 changed files with 3 additions and 0 deletions
  1. 3 0
      libc/stdio/stdio.c

+ 3 - 0
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;
 		}