From: drepper Date: Wed, 18 Aug 1999 23:05:01 +0000 (+0000) Subject: (_IO_file_xsgetn): Allocate buffer if none is allocated so far. X-Git-Tag: glibc_2-1-91~6397 X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=commitdiff_plain;h=0e5ede77f61c03af1d3344471403b3431f9049a0;hp=011feebd00bbf11e02159923dc6446518eb0bb44 (_IO_file_xsgetn): Allocate buffer if none is allocated so far. --- diff --git a/libio/fileops.c b/libio/fileops.c index decb9d7185..7c6e271495 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -849,6 +849,17 @@ _IO_file_xsgetn (fp, data, n) want = n; + if (fp->_IO_buf_base == NULL) + { + /* Maybe we already have a push back pointer. */ + if (fp->_IO_save_base != NULL) + { + free (fp->_IO_save_base); + fp->_flags &= ~_IO_IN_BACKUP; + } + _IO_doallocbuf (fp); + } + while (want > 0) { have = fp->_IO_read_end - fp->_IO_read_ptr;