From: George Koehler Date: Sat, 28 Oct 2017 20:20:48 +0000 (-0400) Subject: Don't check ferror(fp) when reading fp. X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=75ae957c751530d8c57c458bfd470dcd8c0d94c7;p=ack.git 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/ --- diff --git a/lang/cem/libcc.ansi/stdio/fillbuf.c b/lang/cem/libcc.ansi/stdio/fillbuf.c index 02abebc7c..d01e208bf 100644 --- a/lang/cem/libcc.ansi/stdio/fillbuf.c +++ b/lang/cem/libcc.ansi/stdio/fillbuf.c @@ -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;