projects
/
oweals
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0e2c9fb
)
less: add a bit more robustness in keyboard reading code
author
Denis Vlasenko
<vda.linux@googlemail.com>
Fri, 3 Aug 2007 14:17:21 +0000
(14:17 -0000)
committer
Denis Vlasenko
<vda.linux@googlemail.com>
Fri, 3 Aug 2007 14:17:21 +0000
(14:17 -0000)
miscutils/less.c
patch
|
blob
|
history
diff --git
a/miscutils/less.c
b/miscutils/less.c
index 9b2c43bd57909afe6e9b5d21e229f33de9c499aa..a6649c5ca30b6028a7ea80526196c829e410ea77 100644
(file)
--- a/
miscutils/less.c
+++ b/
miscutils/less.c
@@
-699,10
+699,11
@@
static int less_getch(void)
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
@@
static char* less_gets(int sz)
* 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;