From b73eb4057eb85f46b101a54f3d075d08df0aab33 Mon Sep 17 00:00:00 2001 From: ceriel Date: Thu, 7 Oct 1993 09:44:03 +0000 Subject: [PATCH] Fix: set error flag in some error cases --- lang/cem/libcc.ansi/stdio/fillbuf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lang/cem/libcc.ansi/stdio/fillbuf.c b/lang/cem/libcc.ansi/stdio/fillbuf.c index 1fea48bdb..0b3d0f45c 100644 --- a/lang/cem/libcc.ansi/stdio/fillbuf.c +++ b/lang/cem/libcc.ansi/stdio/fillbuf.c @@ -18,8 +18,14 @@ __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, _IOREAD)) return EOF; - if (io_testflag(stream, _IOWRITING)) return EOF; + if (!io_testflag(stream, _IOREAD)) { + stream->_flags |= _IOERR; + return EOF; + } + if (io_testflag(stream, _IOWRITING)) { + stream->_flags |= _IOERR; + return EOF; + } if (!io_testflag(stream, _IOREADING)) stream->_flags |= _IOREADING; -- 2.34.1