aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard M. Stallman1993-11-18 09:45:27 +0000
committerRichard M. Stallman1993-11-18 09:45:27 +0000
commit38f6438b72e6dba67bd6f6c5e2bef4b53a179b30 (patch)
tree36f5682843acbb47df4cb47876254f15c068ef28 /src
parent0e93a7cf3fe10e76ef313e6d7ff4936c2d86ac12 (diff)
downloademacs-38f6438b72e6dba67bd6f6c5e2bef4b53a179b30.tar.gz
emacs-38f6438b72e6dba67bd6f6c5e2bef4b53a179b30.zip
(read_avail_input): Don't set nread to -1
if we loop around in the loop that calls read.
Diffstat (limited to 'src')
-rw-r--r--src/keyboard.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index 47092b339fe..7a0e2fa1f17 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -3059,23 +3059,26 @@ read_avail_input (expected)
3059 /* Now read; for one reason or another, this will not block. */ 3059 /* Now read; for one reason or another, this will not block. */
3060 while (1) 3060 while (1)
3061 { 3061 {
3062 nread = read (fileno (stdin), cbuf, nread); 3062 int value = read (fileno (stdin), cbuf, nread);
3063#ifdef AIX 3063#ifdef AIX
3064 /* The kernel sometimes fails to deliver SIGHUP for ptys. 3064 /* The kernel sometimes fails to deliver SIGHUP for ptys.
3065 This looks incorrect, but it isn't, because _BSD causes 3065 This looks incorrect, but it isn't, because _BSD causes
3066 O_NDELAY to be defined in fcntl.h as O_NONBLOCK, 3066 O_NDELAY to be defined in fcntl.h as O_NONBLOCK,
3067 and that causes a value other than 0 when there is no input. */ 3067 and that causes a value other than 0 when there is no input. */
3068 if (nread == 0) 3068 if (value == 0)
3069 kill (SIGHUP, 0); 3069 kill (SIGHUP, 0);
3070#endif 3070#endif
3071 /* Retry the read if it is interrupted. */ 3071 /* Retry the read if it is interrupted. */
3072 if (nread >= 0 3072 if (value >= 0
3073 || ! (errno == EAGAIN || errno == EFAULT 3073 || ! (errno == EAGAIN || errno == EFAULT
3074#ifdef EBADSLT 3074#ifdef EBADSLT
3075 || errno == EBADSLT 3075 || errno == EBADSLT
3076#endif 3076#endif
3077 )) 3077 ))
3078 break; 3078 {
3079 nread = value;
3080 break;
3081 }
3079 } 3082 }
3080 3083
3081#ifndef FIONREAD 3084#ifndef FIONREAD