Don't check ferror(fp) when reading fp.
authorGeorge Koehler <xkernigh@netscape.net>
Sat, 28 Oct 2017 20:20:48 +0000 (16:20 -0400)
committerGeorge Koehler <xkernigh@netscape.net>
Sat, 28 Oct 2017 20:20:48 +0000 (16:20 -0400)
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/

lang/cem/libcc.ansi/stdio/fillbuf.c

index 02abebc..d01e208 100644 (file)
@@ -16,7 +16,7 @@ __fillbuf(register FILE *stream)
 
        stream->_count = 0;
        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)) {
                stream->_flags |= _IOERR;
                return EOF;