(_IO_getline_info): Don't read anything for N==0.

From-SVN: r21973
This commit is contained in:
Ulrich Drepper 1998-08-25 14:39:39 +00:00 committed by Ulrich Drepper
parent 55895a7a34
commit e94bc5f266
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
1998-08-25 14:34 Ulrich Drepper <drepper@cygnus.com>
* libio/iogetline.c (_IO_getline_info): Don't read anything for
N == 0. Patch by HJ Lu.
1998-08-23 Mark Mitchell <mark@markmitchell.com>
* iomanip.h: Use __extension__ for `extern' explicit template

View File

@ -58,7 +58,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
{
char *ptr = buf;
if (eof) *eof = 0;
do
while (n != 0)
{
_IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
if (len <= 0)
@ -105,7 +105,7 @@ _IO_getline_info (fp, buf, n, delim, extract_delim, eof)
ptr += len;
n -= len;
}
} while (n != 0);
}
return ptr - buf;
}