Browse code

Better pselect error handling

John Hawthorn authored on 16/09/2018 01:02:32
Showing 1 changed files

... ...
@@ -7,6 +7,7 @@
7 7
 #include <sys/ioctl.h>
8 8
 #include <sys/select.h>
9 9
 #include <signal.h>
10
+#include <errno.h>
10 11
 
11 12
 #include "tty.h"
12 13
 
... ...
@@ -117,7 +118,12 @@ int tty_input_ready(tty_t *tty, long int timeout, int return_on_signal) {
117 118
 			return_on_signal ? NULL : &mask);
118 119
 
119 120
 	if (err < 0) {
120
-		return 0;
121
+		if (errno == EINTR) {
122
+			return 0;
123
+		} else {
124
+			perror("select");
125
+			exit(EXIT_FAILURE);
126
+		}
121 127
 	} else {
122 128
 		return FD_ISSET(tty->fdin, &readfs);
123 129
 	}