From 0ad960a9b08316b5c0305be0a96bddf02b498db4 Mon Sep 17 00:00:00 2001 From: eck Date: Fri, 14 Dec 1990 14:47:26 +0000 Subject: [PATCH] set _IOMYBUF in setvbuf() when necessary --- lang/cem/libcc.ansi/stdio/setvbuf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lang/cem/libcc.ansi/stdio/setvbuf.c b/lang/cem/libcc.ansi/stdio/setvbuf.c index 34ef83b8e..a1b7c012c 100644 --- a/lang/cem/libcc.ansi/stdio/setvbuf.c +++ b/lang/cem/libcc.ansi/stdio/setvbuf.c @@ -23,8 +23,13 @@ setvbuf(register FILE *stream, char *buf, int mode, size_t size) stream->_flags &= ~(_IOMYBUF | _IONBF | _IOLBF); - if (!buf && (mode != _IONBF)) - if ((buf = (char *) malloc(size)) == NULL) retval = EOF; + if (!buf && (mode != _IONBF)) { + if ((buf = (char *) malloc(size)) == NULL) { + retval = EOF; + } else { + stream->_flags |= _IOMYBUF; + } + } if (io_testflag(stream, _IOREADING) || io_testflag(stream, _IOWRITING)) retval = EOF; -- 2.34.1