From c70b5020064d7a13885439796ad66eaa28e94145 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Wed, 26 Nov 2025 16:14:38 -0800 Subject: [PATCH] display message if KIONREAD ioctl fails. --- main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/main.c b/main.c index d7e3d1f..3e6d27b 100644 --- a/main.c +++ b/main.c @@ -2918,6 +2918,15 @@ kbhit(void) { int bytes_waiting; ioctl(STDIN_FILENO, FIONREAD, &bytes_waiting); + + if (bytes_waiting < 0) { + editor_set_status("kbhit: FIONREAD failed: %s", strerror(errno)); + + /* if FIONREAD fails, we need to assume we should read. this + * will default to a much slower input sequence, but it'll work. + */ + return 1; + } return bytes_waiting > 0; }