Don't check ferror(fp) when reading fp.

If feof(fp) or ferror(fp) was set, then our libc returned EOF for all
later reads without trying to read.  Our libc now behaves like BSD
(and probably Illumos and musl) by checking only feof(fp).  For
difference, glibc doesn't check feof(fp).

I described the difference between our libc and BSD libc in
https://sourceforge.net/p/tack/mailman/message/35430300/
This commit is contained in:
George Koehler 2017-10-28 16:20:48 -04:00
parent 54028e403e
commit 75ae957c75

View file

@ -16,7 +16,7 @@ __fillbuf(register FILE *stream)
stream->_count = 0; stream->_count = 0;
if (fileno(stream) < 0) return EOF; if (fileno(stream) < 0) return EOF;
if (io_testflag(stream, (_IOEOF | _IOERR ))) return EOF; if (io_testflag(stream, _IOEOF)) return EOF;
if (!io_testflag(stream, _IOREAD)) { if (!io_testflag(stream, _IOREAD)) {
stream->_flags |= _IOERR; stream->_flags |= _IOERR;
return EOF; return EOF;