From: eck Date: Fri, 14 Dec 1990 14:47:26 +0000 (+0000) Subject: set _IOMYBUF in setvbuf() when necessary X-Git-Tag: release-5-5~1343 X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=0ad960a9b08316b5c0305be0a96bddf02b498db4;p=ack.git set _IOMYBUF in setvbuf() when necessary --- 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;