summaryrefslogtreecommitdiff
path: root/libio
diff options
context:
space:
mode:
authordrepper <drepper@138bc75d-0d04-0410-961f-82ee72b054a4>1998-08-25 14:39:39 +0000
committerdrepper <drepper@138bc75d-0d04-0410-961f-82ee72b054a4>1998-08-25 14:39:39 +0000
commit4167440db62edeb14f51ffd87fecd1eec4a415e6 (patch)
treee4855d958744f0300da2a54975ddb72a105a700d /libio
parente543d5b0eec2e39035aed74899bb867ab8530888 (diff)
downloadgcc-4167440db62edeb14f51ffd87fecd1eec4a415e6.tar.gz
(_IO_getline_info): Don't read anything for N==0.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@21973 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libio')
-rw-r--r--libio/ChangeLog5
-rw-r--r--libio/iogetline.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/libio/ChangeLog b/libio/ChangeLog
index ee9ce72478e..90a521ce347 100644
--- a/libio/ChangeLog
+++ b/libio/ChangeLog
@@ -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
diff --git a/libio/iogetline.c b/libio/iogetline.c
index 631db78d127..5aac9b56387 100644
--- a/libio/iogetline.c
+++ b/libio/iogetline.c
@@ -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;
}