aboutsummaryrefslogtreecommitdiff
path: root/editors/vi.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-17 03:02:40 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-17 11:46:23 +0100
commit12566e7f9b5e5c5d445bc4d36991d134b431dc6c (patch)
tree2571356a77f7d421da368e9b31dad182e83b2408 /editors/vi.c
parenta277506a64404e6c4472ff89c944c4f353db1c33 (diff)
downloadbusybox-w32-12566e7f9b5e5c5d445bc4d36991d134b431dc6c.tar.gz
busybox-w32-12566e7f9b5e5c5d445bc4d36991d134b431dc6c.tar.bz2
busybox-w32-12566e7f9b5e5c5d445bc4d36991d134b431dc6c.zip
ash,hush: fix handling of SIGINT while waiting for interactive input
function old new delta lineedit_read_key 160 237 +77 __pgetc 522 589 +67 fgetc_interactive 244 309 +65 safe_read_key - 39 +39 read_key 588 607 +19 record_pending_signo 23 32 +9 signal_handler 75 81 +6 .rodata 104312 104309 -3 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 6/1 up/down: 282/-3) Total: 279 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'editors/vi.c')
-rw-r--r--editors/vi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/editors/vi.c b/editors/vi.c
index 3dbe5b471..d37cd48a3 100644
--- a/editors/vi.c
+++ b/editors/vi.c
@@ -1122,7 +1122,7 @@ static int readit(void) // read (maybe cursor) key from stdin
1122 // on nonblocking stdin. 1122 // on nonblocking stdin.
1123 // Note: read_key sets errno to 0 on success. 1123 // Note: read_key sets errno to 0 on success.
1124 again: 1124 again:
1125 c = read_key(STDIN_FILENO, readbuffer, /*timeout:*/ -1); 1125 c = safe_read_key(STDIN_FILENO, readbuffer, /*timeout:*/ -1);
1126 if (c == -1) { // EOF/error 1126 if (c == -1) { // EOF/error
1127 if (errno == EAGAIN) // paranoia 1127 if (errno == EAGAIN) // paranoia
1128 goto again; 1128 goto again;
@@ -4770,7 +4770,7 @@ static void edit_file(char *fn)
4770 uint64_t k; 4770 uint64_t k;
4771 write1(ESC"[999;999H" ESC"[6n"); 4771 write1(ESC"[999;999H" ESC"[6n");
4772 fflush_all(); 4772 fflush_all();
4773 k = read_key(STDIN_FILENO, readbuffer, /*timeout_ms:*/ 100); 4773 k = safe_read_key(STDIN_FILENO, readbuffer, /*timeout_ms:*/ 100);
4774 if ((int32_t)k == KEYCODE_CURSOR_POS) { 4774 if ((int32_t)k == KEYCODE_CURSOR_POS) {
4775 uint32_t rc = (k >> 32); 4775 uint32_t rc = (k >> 32);
4776 columns = (rc & 0x7fff); 4776 columns = (rc & 0x7fff);