summaryrefslogtreecommitdiff
path: root/src/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tty.c')
-rw-r--r--src/tty.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/tty.c b/src/tty.c
index a81fe85..2481475 100644
--- a/src/tty.c
+++ b/src/tty.c
@@ -96,7 +96,7 @@ char tty_getchar(tty_t *tty) {
}
}
-int tty_input_ready(tty_t *tty, unsigned long timeout, int return_on_signal) {
+int tty_input_ready(tty_t *tty, long int timeout, int return_on_signal) {
fd_set readfs;
FD_ZERO(&readfs);
FD_SET(tty->fdin, &readfs);
@@ -108,7 +108,13 @@ int tty_input_ready(tty_t *tty, unsigned long timeout, int return_on_signal) {
if (!return_on_signal)
sigaddset(&mask, SIGWINCH);
- int err = pselect(tty->fdin + 1, &readfs, NULL, NULL, &ts, &mask);
+ int err = pselect(
+ tty->fdin + 1,
+ &readfs,
+ NULL,
+ NULL,
+ timeout < 0 ? NULL : &ts,
+ return_on_signal ? NULL : &mask);
if (err < 0) {
return 0;