less: fix newly-introduced case of less spinning forever
on pty's closed etc
This commit is contained in:
parent
028eab61bc
commit
64974793b9
@ -853,12 +853,16 @@ static ssize_t getch_nowait(void)
|
|||||||
/* We have kbd_fd in O_NONBLOCK mode, read inside read_key()
|
/* We have kbd_fd in O_NONBLOCK mode, read inside read_key()
|
||||||
* would not block even if there is no input available */
|
* would not block even if there is no input available */
|
||||||
rd = read_key(kbd_fd, NULL, input);
|
rd = read_key(kbd_fd, NULL, input);
|
||||||
if (rd == -1 && errno == EAGAIN) {
|
if (rd == -1) {
|
||||||
/* No keyboard input available. Since poll() did return,
|
if (errno == EAGAIN) {
|
||||||
* we should have input on stdin */
|
/* No keyboard input available. Since poll() did return,
|
||||||
read_lines();
|
* we should have input on stdin */
|
||||||
buffer_fill_and_print();
|
read_lines();
|
||||||
goto again;
|
buffer_fill_and_print();
|
||||||
|
goto again;
|
||||||
|
}
|
||||||
|
/* EOF/error (ssh session got killed etc) */
|
||||||
|
less_exit(0);
|
||||||
}
|
}
|
||||||
set_tty_cooked();
|
set_tty_cooked();
|
||||||
return rd;
|
return rd;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user