changeset 5064:e1843fccd1f2

(read_avail_input): Don't set nread to -1 if we loop around in the loop that calls read.
author Richard M. Stallman <rms@gnu.org>
date Thu, 18 Nov 1993 09:45:27 +0000
parents 9ab921a16318
children cd3d59bc0b94
files src/keyboard.c
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/keyboard.c	Thu Nov 18 09:26:05 1993 +0000
+++ b/src/keyboard.c	Thu Nov 18 09:45:27 1993 +0000
@@ -3059,23 +3059,26 @@
       /* 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