Mercurial > emacs
comparison src/keyboard.c @ 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 | 2802aff49c77 |
children | a928c879b7ea |
comparison
equal
deleted
inserted
replaced
5063:9ab921a16318 | 5064:e1843fccd1f2 |
---|---|
3057 #endif | 3057 #endif |
3058 | 3058 |
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 |
3082 #ifdef USG | 3085 #ifdef USG |
3083 fcntl (fileno (stdin), F_SETFL, 0); | 3086 fcntl (fileno (stdin), F_SETFL, 0); |