From dc0a9a8e2d56ad9d7b7879fac9935787ce7e8043 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Sat, 15 Sep 2018 14:12:14 -0700 Subject: Return 0 on pselect EINTR --- src/tty.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/tty.c b/src/tty.c index c84606e..5d7da64 100644 --- a/src/tty.c +++ b/src/tty.c @@ -96,8 +96,13 @@ int tty_input_ready(tty_t *tty, unsigned long timeout) { struct timespec ts = {timeout / 1000, (timeout % 1000) * 1000000}; - pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL); - return FD_ISSET(tty->fdin, &readfs); + int err = pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL); + + if (err < 0) { + return 0; + } else { + return FD_ISSET(tty->fdin, &readfs); + } } static void tty_sgr(tty_t *tty, int code) { -- cgit v1.2.3