-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
busybox: fix ash segfaults after interrupting applet
Backported fix from Busybox v1.36. DONE: RTOS-773
- Loading branch information
1 parent
7a859f9
commit 46f7c3d
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
diff --git a/shell/ash.c b/shell/ash.c | ||
--- a/shell/ash.c | ||
+++ b/shell/ash.c | ||
@@ -9745,9 +9745,18 @@ evalcommand(union node *cmd, int flags) | ||
/* find_command() encodes applet_no as (-2 - applet_no) */ | ||
int applet_no = (- cmdentry.u.index - 2); | ||
if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) { | ||
+ INT_OFF; | ||
listsetvar(varlist.list, VEXPORT|VSTACK); | ||
- /* run <applet>_main() */ | ||
+ /* | ||
+ * Run <applet>_main(). | ||
+ * Signals (^C) can't interrupt here. | ||
+ * Otherwise we can mangle stdio or malloc internal state. | ||
+ * This makes applets which can run for a long time | ||
+ * and/or wait for user input ineligible for NOFORK: | ||
+ * for example, "yes" or "rm" (rm -i waits for input). | ||
+ */ | ||
status = run_nofork_applet(applet_no, argv); | ||
+ INT_ON; | ||
break; | ||
} | ||
#endif |