Error set on EOF

Alex Waugh ajw498 at ecs.soton.ac.uk
Mon Mar 4 03:44:22 PST 2002


On Sun, 24 Feb 2002, Alex Waugh wrote:

> On Sun, 17 Feb 2002, I wrote:
>
> > 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.
>
> Don't bother committing this, as it seems to break something. I'll post a
> better solution when I found what the problem is.

OK, I was looking in the wrong place. filbuf.c is correct, the problem is
in tty.c where an error is set when EOF is encountered in canonical input.

Index: tty.c
===================================================================
RCS file: /usr/local/cvsroot/gccsdk/unixlib/source/unix/tty.c,v
retrieving revision 1.4.2.11
diff -u -r1.4.2.11 tty.c
--- tty.c	2002/01/12 16:06:57	1.4.2.11
+++ tty.c	2002/03/04 11:39:36
@@ -607,7 +607,7 @@
   if (tty == __u->tty)
     __os_byte (0xe5, 0, 0, 0);	/* Re-enable SIGINT.  */

-  if (tty->cnt == 0)
+  if (tty->cnt == 0 && c != ceof)
     return __set_errno (EAGAIN);

   return 0;


-- 
Alex Waugh                               alex at alexwaugh.com

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




More information about the gcc mailing list