diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/keyboard.c | 11 |
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 |