summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--miscutils/less.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/miscutils/less.c b/miscutils/less.c
index 9b2c43bd5..a6649c5ca 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -699,10 +699,11 @@ static int less_getch(void)
699 char input[16]; 699 char input[16];
700 unsigned i; 700 unsigned i;
701 again: 701 again:
702 memset(input, 0, sizeof(input));
702 getch_nowait(input, sizeof(input)); 703 getch_nowait(input, sizeof(input));
704
703 /* Detect escape sequences (i.e. arrow keys) and handle 705 /* Detect escape sequences (i.e. arrow keys) and handle
704 * them accordingly */ 706 * them accordingly */
705
706 if (input[0] == '\033' && input[1] == '[') { 707 if (input[0] == '\033' && input[1] == '[') {
707 set_tty_cooked(); 708 set_tty_cooked();
708 i = input[2] - REAL_KEY_UP; 709 i = input[2] - REAL_KEY_UP;
@@ -740,6 +741,7 @@ static char* less_gets(int sz)
740 * but it is needed. Is it because of stdio? */ 741 * but it is needed. Is it because of stdio? */
741 tcsetattr(kbd_fd, TCSANOW, &term_less); 742 tcsetattr(kbd_fd, TCSANOW, &term_less);
742 743
744 c = '\0';
743 read(kbd_fd, &c, 1); 745 read(kbd_fd, &c, 1);
744 if (c == 0x0d) 746 if (c == 0x0d)
745 return result; 747 return result;