Error set on EOF

Alex Waugh ajw498 at ecs.soton.ac.uk
Sun Feb 17 05:34:23 PST 2002


Hi

The logic in filbuf.c appears to be wrong when an EOF is encountered,
setting stream->__error rather than stream->__eof. The following patch
fixes this.

Index: filbuf.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/stdio/filbuf.c,v
retrieving revision 1.2
diff -u -r1.2 filbuf.c
--- filbuf.c	2001/01/29 15:10:21	1.2
+++ filbuf.c	2002/02/17 13:26:26
@@ -80,9 +80,9 @@
     {
       /* A file error occurred.  */
       if (count == -1)
-	stream->__error = 1;
-      else
 	stream->__eof = 1;
+      else
+	stream->__error = 1;

       if (stream->i_base != NULL)
 	{


-- 
Alex Waugh                               alex at alexwaugh.com

PHP, Roots, WebJames and more from http://www.alexwaugh.com/




More information about the gcc mailing list