This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: bug in fstream get(Ch *p, streamsize n, Ch term )


> 
> hjl@innovix.com (H.J. Lu) writes:
> 
> > I think we should fix egcs, glibc 2.0 and glibc 2.1.
> 
> Thanks, the patch is in.  Though not in glibc 2.0 since the code does
> not have this problem.
> 

Why not?

-- 
H.J. Lu (hjl@gnu.org)
----
Tue Aug 25 16:23:19 1998  H.J. Lu  (hjl@gnu.org)

	* libio/iogetline.c (_IO_getline): Check if n == 0.

Index: libio/iogetline.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc-2.0/libio/iogetline.c,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 iogetline.c
--- iogetline.c	1997/09/19 18:10:38	1.1.1.1
+++ iogetline.c	1998/08/25 23:24:38
@@ -39,7 +39,7 @@ DEFUN(_IO_getline, (fp, buf, n, delim, e
       AND int delim AND int extract_delim)
 {
   register char *ptr = buf;
-  do
+  while (n != 0)
     {
       _IO_ssize_t len = fp->_IO_read_end - fp->_IO_read_ptr;
       char *t;
@@ -69,6 +69,6 @@ DEFUN(_IO_getline, (fp, buf, n, delim, e
       fp->_IO_read_ptr += len;
       ptr += len;
       n -= len;
-    } while (n != 0);
+    }
   return ptr - buf;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]