aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-06-18 14:08:34 +0100
committerRon Yorston <rmy@pobox.com>2021-06-18 14:08:34 +0100
commit96a647690a67141cf4edc76cd4f067617e0f69b6 (patch)
treeb7ae0be28dbb13beb8563b0f7f678bcbf985d019
parentf7e4fe39a69b82bcef1aaa68111ccfa68b209ada (diff)
downloadbusybox-w32-96a647690a67141cf4edc76cd4f067617e0f69b6.tar.gz
busybox-w32-96a647690a67141cf4edc76cd4f067617e0f69b6.tar.bz2
busybox-w32-96a647690a67141cf4edc76cd4f067617e0f69b6.zip
ash: prevent issue with ctrl-c and echo in loop
Interrupting a loop like this: while true; do echo hello; done with ctrl-c caused the shell to exit. Turning off interrupts around the calls to echo_main() and printf_main() improves matters, though isn't a complete cure.
-rw-r--r--shell/ash.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 14712ef54..bab6138da 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -10815,12 +10815,35 @@ static int ulimitcmd(int, char **) FAST_FUNC;
10815#define BUILTIN_SPEC_REG_ASSG "7" 10815#define BUILTIN_SPEC_REG_ASSG "7"
10816 10816
10817/* Stubs for calling non-FAST_FUNC's */ 10817/* Stubs for calling non-FAST_FUNC's */
10818#if !ENABLE_PLATFORM_MINGW32
10818#if ENABLE_ASH_ECHO 10819#if ENABLE_ASH_ECHO
10819static int FAST_FUNC echocmd(int argc, char **argv) { return echo_main(argc, argv); } 10820static int FAST_FUNC echocmd(int argc, char **argv) { return echo_main(argc, argv); }
10820#endif 10821#endif
10821#if ENABLE_ASH_PRINTF 10822#if ENABLE_ASH_PRINTF
10822static int FAST_FUNC printfcmd(int argc, char **argv) { return printf_main(argc, argv); } 10823static int FAST_FUNC printfcmd(int argc, char **argv) { return printf_main(argc, argv); }
10823#endif 10824#endif
10825#else
10826#if ENABLE_ASH_ECHO
10827static int FAST_FUNC echocmd(int argc, char **argv)
10828{
10829 int ret;
10830 INT_OFF;
10831 ret = echo_main(argc, argv);
10832 INT_ON;
10833 return ret;
10834}
10835#endif
10836#if ENABLE_ASH_PRINTF
10837static int FAST_FUNC printfcmd(int argc, char **argv)
10838{
10839 int ret;
10840 INT_OFF;
10841 ret = printf_main(argc, argv);
10842 INT_ON;
10843 return ret;
10844}
10845#endif
10846#endif
10824#if ENABLE_ASH_TEST || BASH_TEST2 10847#if ENABLE_ASH_TEST || BASH_TEST2
10825static int FAST_FUNC testcmd(int argc, char **argv) { return test_main(argc, argv); } 10848static int FAST_FUNC testcmd(int argc, char **argv) { return test_main(argc, argv); }
10826#endif 10849#endif