diff options
Diffstat (limited to 'shell')
-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 |