diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 8 |
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) | |||
10784 | line_input_state->path_lookup = pathval(); | 10784 | line_input_state->path_lookup = pathval(); |
10785 | # endif | 10785 | # endif |
10786 | reinit_unicode_for_ash(); | 10786 | reinit_unicode_for_ash(); |
10787 | again: | ||
10787 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ); | 10788 | nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ); |
10788 | if (nr == 0) { | 10789 | if (nr == 0) { |
10789 | /* ^C pressed, "convert" to SIGINT */ | 10790 | /* ^C pressed, "convert" to SIGINT */ |
10790 | write(STDOUT_FILENO, "^C", 2); | 10791 | write(STDOUT_FILENO, "^C", 2); |
10791 | raise(SIGINT); | 10792 | raise(SIGINT); |
10793 | /* raise(SIGINT) did not work! (e.g. if SIGINT | ||
10794 | * is SIG_INGed on startup, it stays SIG_IGNed) | ||
10795 | */ | ||
10792 | if (trap[SIGINT]) { | 10796 | if (trap[SIGINT]) { |
10793 | buf[0] = '\n'; | 10797 | buf[0] = '\n'; |
10794 | buf[1] = '\0'; | 10798 | buf[1] = '\0'; |
10795 | return 1; | 10799 | return 1; |
10796 | } | 10800 | } |
10797 | exitstatus = 128 + SIGINT; | 10801 | exitstatus = 128 + SIGINT; |
10798 | return -1; | 10802 | /* bash behavior on ^C + ignored SIGINT: */ |
10803 | write(STDOUT_FILENO, "\n", 1); | ||
10804 | goto again; | ||
10799 | } | 10805 | } |
10800 | if (nr < 0) { | 10806 | if (nr < 0) { |
10801 | if (errno == 0) { | 10807 | if (errno == 0) { |