display message if KIONREAD ioctl fails.

This commit is contained in:
2025-11-26 16:14:38 -08:00
parent e14d620887
commit c70b502006

9
main.c
View File

@@ -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;
}