aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2022-02-27 12:56:21 +0000
committerRon Yorston <rmy@pobox.com>2022-02-27 12:56:21 +0000
commit96c104a61c9a75c478eb6e830653a830d72fe8fb (patch)
treed5fe5d6b99b94bf1af258d45ffaa36444663ef06
parent67d6d366161c04ec32f2b429a2441016dfd91f2a (diff)
downloadbusybox-w32-96c104a61c9a75c478eb6e830653a830d72fe8fb.tar.gz
busybox-w32-96c104a61c9a75c478eb6e830653a830d72fe8fb.tar.bz2
busybox-w32-96c104a61c9a75c478eb6e830653a830d72fe8fb.zip
ash: try harder to avoid ctrl-c issue
Commit 96a647690 (ash: prevent issue with ctrl-c and echo in loop) attempted to fix the problem that interrupting a loop like: while true; do echo hello; done caused the shell to exit. However, it wasn't completely effective and it only applied to echo and printf, not other builtins. Revert 96a647690 and instead don't call raise_interrupt() from crtl_handler() for the foreground interactive shell.
-rw-r--r--shell/ash.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/shell/ash.c b/shell/ash.c
index c9122b291..d8f9dba34 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4788,7 +4788,7 @@ sprint_status48(char *os, int status, int sigonly)
4788static BOOL WINAPI ctrl_handler(DWORD dwCtrlType) 4788static BOOL WINAPI ctrl_handler(DWORD dwCtrlType)
4789{ 4789{
4790 if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) { 4790 if (dwCtrlType == CTRL_C_EVENT || dwCtrlType == CTRL_BREAK_EVENT) {
4791 if (!suppress_int) 4791 if (!suppress_int && !(rootshell && iflag))
4792 raise_interrupt(); /* does not return */ 4792 raise_interrupt(); /* does not return */
4793 pending_int = 1; 4793 pending_int = 1;
4794 return TRUE; 4794 return TRUE;
@@ -10970,35 +10970,12 @@ static int ulimitcmd(int, char **) FAST_FUNC;
10970#define BUILTIN_SPEC_REG_ASSG "7" 10970#define BUILTIN_SPEC_REG_ASSG "7"
10971 10971
10972/* Stubs for calling non-FAST_FUNC's */ 10972/* Stubs for calling non-FAST_FUNC's */
10973#if !ENABLE_PLATFORM_MINGW32
10974#if ENABLE_ASH_ECHO 10973#if ENABLE_ASH_ECHO
10975static int FAST_FUNC echocmd(int argc, char **argv) { return echo_main(argc, argv); } 10974static int FAST_FUNC echocmd(int argc, char **argv) { return echo_main(argc, argv); }
10976#endif 10975#endif
10977#if ENABLE_ASH_PRINTF 10976#if ENABLE_ASH_PRINTF
10978static int FAST_FUNC printfcmd(int argc, char **argv) { return printf_main(argc, argv); } 10977static int FAST_FUNC printfcmd(int argc, char **argv) { return printf_main(argc, argv); }
10979#endif 10978#endif
10980#else
10981#if ENABLE_ASH_ECHO
10982static int FAST_FUNC echocmd(int argc, char **argv)
10983{
10984 int ret;
10985 INT_OFF;
10986 ret = echo_main(argc, argv);
10987 INT_ON;
10988 return ret;
10989}
10990#endif
10991#if ENABLE_ASH_PRINTF
10992static int FAST_FUNC printfcmd(int argc, char **argv)
10993{
10994 int ret;
10995 INT_OFF;
10996 ret = printf_main(argc, argv);
10997 INT_ON;
10998 return ret;
10999}
11000#endif
11001#endif
11002#if ENABLE_ASH_TEST || BASH_TEST2 10979#if ENABLE_ASH_TEST || BASH_TEST2
11003static int FAST_FUNC testcmd(int argc, char **argv) { return test_main(argc, argv); } 10980static int FAST_FUNC testcmd(int argc, char **argv) { return test_main(argc, argv); }
11004#endif 10981#endif