summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2000-07-10 03:10:18 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2000-07-10 03:10:18 +0000
commit7c5417dd3c8525baae999c47318242899a8b9694 (patch)
tree7f86da1884376e1aca8565f511c79633d6496b95
parente3af44217703da8d3b5b2bc031f1913662972a8d (diff)
Bail if getch() returns ERR. In ncurses < 5.1 getch() incorrectly
returned 0 on EOF (due to a side effect of how curses buffers reads).
-rw-r--r--usr.bin/systat/keyboard.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/systat/keyboard.c b/usr.bin/systat/keyboard.c
index 120dc0cc38d..b7e73df32d1 100644
--- a/usr.bin/systat/keyboard.c
+++ b/usr.bin/systat/keyboard.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: keyboard.c,v 1.5 2000/06/04 23:06:17 aaron Exp $ */
+/* $OpenBSD: keyboard.c,v 1.6 2000/07/10 03:10:17 millert Exp $ */
/* $NetBSD: keyboard.c,v 1.2 1995/01/20 08:51:59 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)keyboard.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: keyboard.c,v 1.5 2000/06/04 23:06:17 aaron Exp $";
+static char rcsid[] = "$OpenBSD: keyboard.c,v 1.6 2000/07/10 03:10:17 millert Exp $";
#endif /* not lint */
#include <ctype.h>
@@ -59,7 +59,9 @@ keyboard()
move(CMDLINE, 0);
do {
refresh();
- ch = getch() & 0177;
+ if ((ch = getch()) == ERR)
+ exit(1);
+ ch &= 0177;
if (ch == 0177 && ferror(stdin)) {
clearerr(stdin);
continue;