diff options
Diffstat (limited to 'osdep/getch2.c')
-rw-r--r-- | osdep/getch2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c index 13eb47bc29..8b87e79c76 100644 --- a/osdep/getch2.c +++ b/osdep/getch2.c @@ -27,6 +27,7 @@ #include <stdint.h> #include <string.h> #include <signal.h> +#include <errno.h> #include <sys/ioctl.h> #ifdef HAVE_TERMIOS @@ -366,8 +367,10 @@ bool getch2(struct input_ctx *input_ctx) * happen if the terminal state change done in getch2_enable() * works. */ - if (retval < 1) - return retval; + if (retval == 0) + return false; + if (retval == -1) + return errno != EBADF && errno != EINVAL; getch2_len += retval; while (getch2_pos < getch2_len) { |