Browse code

Return 0 on pselect EINTR

John Hawthorn authored on 15/09/2018 21:12:14
Showing 1 changed files

... ...
@@ -96,8 +96,13 @@ int tty_input_ready(tty_t *tty, unsigned long timeout) {
96 96
 
97 97
 	struct timespec ts = {timeout / 1000, (timeout % 1000) * 1000000};
98 98
 
99
-	pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL);
100
-	return FD_ISSET(tty->fdin, &readfs);
99
+	int err = pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, NULL);
100
+
101
+	if (err < 0) {
102
+		return 0;
103
+	} else {
104
+		return FD_ISSET(tty->fdin, &readfs);
105
+	}
101 106
 }
102 107
 
103 108
 static void tty_sgr(tty_t *tty, int code) {