summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hawthorn <john@hawthorn.email>2018-09-15 14:12:14 -0700
committerJohn Hawthorn <john@hawthorn.email>2018-09-23 11:23:53 -0700
commitdc0a9a8e2d56ad9d7b7879fac9935787ce7e8043 (patch)
treed9f8eeb84b55d5eac98120081d746f0833fe1f94 /src
parent83e6fedf9b4c436a4adbdc136d5617a783a1e1e8 (diff)
Return 0 on pselect EINTR
Diffstat (limited to 'src')
-rw-r--r--src/tty.c9
1 files changed, 7 insertions, 2 deletions
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) {