aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-11-16 13:09:37 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-11-16 13:09:37 +0100
commit4ac35a30db0c9badd9895c5eaa1d4d3a118b5259 (patch)
tree1e8a7a9fd690b5df9e5eb816dced7beebcc37834 /shell
parentdc9c10a7b29c93a36ff17c562cb14e11eb169f19 (diff)
downloadbusybox-4ac35a30db0c9badd9895c5eaa1d4d3a118b5259.tar.gz
ash: make interactive ^C break out of PS2 mode
Based on patch by Joachim Nilsson <troglobit@gmail.com> function old new delta pgetc 570 547 -23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 674a41bd3..d1ca3451d 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10593,7 +10593,7 @@ preadfd(void)
g_parsefile->next_to_pgetc = buf;
#if ENABLE_FEATURE_EDITING
- retry:
+ /* retry: */
if (!iflag || g_parsefile->pf_fd != STDIN_FILENO)
nr = nonblock_immune_read(g_parsefile->pf_fd, buf, IBUFSIZ - 1);
else {
@@ -10615,15 +10615,14 @@ preadfd(void)
if (nr == 0) {
/* ^C pressed, "convert" to SIGINT */
write(STDOUT_FILENO, "^C", 2);
+ raise(SIGINT);
if (trap[SIGINT]) {
buf[0] = '\n';
buf[1] = '\0';
- raise(SIGINT);
return 1;
}
exitstatus = 128 + SIGINT;
- bb_putchar('\n');
- goto retry;
+ return -1;
}
if (nr < 0) {
if (errno == 0) {