From 75ae957c751530d8c57c458bfd470dcd8c0d94c7 Mon Sep 17 00:00:00 2001 From: George Koehler Date: Sat, 28 Oct 2017 16:20:48 -0400 Subject: [PATCH] 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/ --- lang/cem/libcc.ansi/stdio/fillbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1