svn commit: trunk/busybox/miscutils
vda at busybox.net
vda at busybox.net
Fri Aug 3 07:17:23 PDT 2007
Author: vda
Date: 2007-08-03 07:17:21 -0700 (Fri, 03 Aug 2007)
New Revision: 19403
Log:
less: add a bit more robustness in keyboard reading code
Modified:
trunk/busybox/miscutils/less.c
Changeset:
Modified: trunk/busybox/miscutils/less.c
===================================================================
--- trunk/busybox/miscutils/less.c 2007-08-03 14:16:24 UTC (rev 19402)
+++ trunk/busybox/miscutils/less.c 2007-08-03 14:17:21 UTC (rev 19403)
@@ -699,10 +699,11 @@
char input[16];
unsigned i;
again:
+ memset(input, 0, sizeof(input));
getch_nowait(input, sizeof(input));
+
/* Detect escape sequences (i.e. arrow keys) and handle
* them accordingly */
-
if (input[0] == '\033' && input[1] == '[') {
set_tty_cooked();
i = input[2] - REAL_KEY_UP;
@@ -740,6 +741,7 @@
* but it is needed. Is it because of stdio? */
tcsetattr(kbd_fd, TCSANOW, &term_less);
+ c = '\0';
read(kbd_fd, &c, 1);
if (c == 0x0d)
return result;
More information about the busybox-cvs
mailing list