Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.busybox.net/busybox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2022-01-13 03:05:03 +0300
committerDenys Vlasenko <vda.linux@googlemail.com>2022-01-13 03:15:10 +0300
commit68b402ee51f12f8c3b11638b042f57e025359faf (patch)
treef7db9b14b44d89c448fd7d35cae821a97695f7f3 /shell
parentd162a7b978a98b910e410dc10a40d5de12db0419 (diff)
ash: ^C with SIG_INGed SIGINT should not exit the shell
function old new delta __pgetc 501 522 +21 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 4c5dd1298..12b2db3a9 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10784,18 +10784,24 @@ preadfd(void)
line_input_state->path_lookup = pathval();
# endif
reinit_unicode_for_ash();
+ again:
nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ);
if (nr == 0) {
/* ^C pressed, "convert" to SIGINT */
write(STDOUT_FILENO, "^C", 2);
raise(SIGINT);
+ /* raise(SIGINT) did not work! (e.g. if SIGINT
+ * is SIG_INGed on startup, it stays SIG_IGNed)
+ */
if (trap[SIGINT]) {
buf[0] = '\n';
buf[1] = '\0';
return 1;
}
exitstatus = 128 + SIGINT;
- return -1;
+ /* bash behavior on ^C + ignored SIGINT: */
+ write(STDOUT_FILENO, "\n", 1);
+ goto again;
}
if (nr < 0) {
if (errno == 0) {