diff options
-rw-r--r-- | miscutils/less.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index b5d225a12..6c793ad8b 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
@@ -853,12 +853,16 @@ static ssize_t getch_nowait(void) | |||
853 | /* We have kbd_fd in O_NONBLOCK mode, read inside read_key() | 853 | /* We have kbd_fd in O_NONBLOCK mode, read inside read_key() |
854 | * would not block even if there is no input available */ | 854 | * would not block even if there is no input available */ |
855 | rd = read_key(kbd_fd, NULL, input); | 855 | rd = read_key(kbd_fd, NULL, input); |
856 | if (rd == -1 && errno == EAGAIN) { | 856 | if (rd == -1) { |
857 | /* No keyboard input available. Since poll() did return, | 857 | if (errno == EAGAIN) { |
858 | * we should have input on stdin */ | 858 | /* No keyboard input available. Since poll() did return, |
859 | read_lines(); | 859 | * we should have input on stdin */ |
860 | buffer_fill_and_print(); | 860 | read_lines(); |
861 | goto again; | 861 | buffer_fill_and_print(); |
862 | goto again; | ||
863 | } | ||
864 | /* EOF/error (ssh session got killed etc) */ | ||
865 | less_exit(0); | ||
862 | } | 866 | } |
863 | set_tty_cooked(); | 867 | set_tty_cooked(); |
864 | return rd; | 868 | return rd; |