diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 14:50:03 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-08-04 14:50:03 +0200 |
commit | d329e34c96e0429602fe39489586cd61f97a2877 (patch) | |
tree | 07cf107ccb60bf27a7d605b3375215f8df1fea15 | |
parent | 49e6bf2db92d896a71d08eb364069ba50fa82781 (diff) | |
download | busybox-w32-d329e34c96e0429602fe39489586cd61f97a2877.tar.gz busybox-w32-d329e34c96e0429602fe39489586cd61f97a2877.tar.bz2 busybox-w32-d329e34c96e0429602fe39489586cd61f97a2877.zip |
ash: INT_OFF/INT_ON around run_nofork_applet()
function old new delta
evalcommand 1441 1447 +6
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index ca9926b54..2afa5e83d 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -9919,10 +9919,26 @@ evalcommand(union node *cmd, int flags) | |||
9919 | int applet_no = (- cmdentry.u.index - 2); | 9919 | int applet_no = (- cmdentry.u.index - 2); |
9920 | if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) { | 9920 | if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) { |
9921 | listsetvar(varlist.list, VEXPORT|VSTACK); | 9921 | listsetvar(varlist.list, VEXPORT|VSTACK); |
9922 | /* run <applet>_main() */ | 9922 | /* |
9923 | //FIXME: do we need INT_OFF / INT_ON here? | 9923 | * Run <applet>_main(). |
9924 | //wouldn't open files and allocations leak on ^C otherwise? | 9924 | * Signals (^C) can't interrupt here. |
9925 | * Otherwise we can mangle stdio or malloc internal state. | ||
9926 | * This makes applets which can run for a long time | ||
9927 | * and/or wait for user input ineligible for NOFORK: | ||
9928 | * for example, "yes" or "rm" (rm -i waits for input). | ||
9929 | */ | ||
9930 | INT_OFF; | ||
9925 | status = run_nofork_applet(applet_no, argv); | 9931 | status = run_nofork_applet(applet_no, argv); |
9932 | /* | ||
9933 | * Try enabling NOFORK for "yes" applet. | ||
9934 | * ^C _will_ stop it (write returns EINTR), | ||
9935 | * but this causes stdout FILE to be stuck | ||
9936 | * and needing clearerr(). What if other applets | ||
9937 | * also can get EINTRs? Do we need to switch | ||
9938 | * our signals to SA_RESTART? | ||
9939 | */ | ||
9940 | /*clearerr(stdout);*/ | ||
9941 | INT_ON; | ||
9926 | break; | 9942 | break; |
9927 | } | 9943 | } |
9928 | #endif | 9944 | #endif |