summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--osdep/getch2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/osdep/getch2.c b/osdep/getch2.c
index eeefa8c9e6..ba474ea51a 100644
--- a/osdep/getch2.c
+++ b/osdep/getch2.c
@@ -34,6 +34,7 @@
#ifdef CONFIG_IOCTL
#include <sys/ioctl.h>
#endif
+#include <errno.h>
#ifdef HAVE_TERMIOS
#ifdef HAVE_TERMIOS_H
@@ -369,8 +370,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;
static enum {