]> code.delx.au - gnu-emacs/commitdiff
(read_avail_input): Don't set nread to -1
authorRichard M. Stallman <rms@gnu.org>
Thu, 18 Nov 1993 09:45:27 +0000 (09:45 +0000)
committerRichard M. Stallman <rms@gnu.org>
Thu, 18 Nov 1993 09:45:27 +0000 (09:45 +0000)
if we loop around in the loop that calls read.

src/keyboard.c

index 47092b339fec743addfdd0330c29689fdf6040d7..7a0e2fa1f17b35ae4e3eb0b2bd3aabd3fa06718d 100644 (file)
@@ -3059,23 +3059,26 @@ read_avail_input (expected)
       /* Now read; for one reason or another, this will not block.  */
       while (1)
        {
-         nread = read (fileno (stdin), cbuf, nread);
+         int value = read (fileno (stdin), cbuf, nread);
 #ifdef AIX
          /* The kernel sometimes fails to deliver SIGHUP for ptys.
             This looks incorrect, but it isn't, because _BSD causes
             O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
             and that causes a value other than 0 when there is no input.  */
-         if (nread == 0)
+         if (value == 0)
            kill (SIGHUP, 0);
 #endif
          /* Retry the read if it is interrupted.  */
-         if (nread >= 0
+         if (value >= 0
              || ! (errno == EAGAIN || errno == EFAULT
 #ifdef EBADSLT
                    || errno == EBADSLT
 #endif
                    ))
-           break;
+           {
+             nread = value;
+             break;
+           }
        }
 
 #ifndef FIONREAD