summaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenis Vlasenko2008-04-12 20:07:53 +0000
committerDenis Vlasenko2008-04-12 20:07:53 +0000
commit9bc80d7062a01aa310be0729c095ba6b652c4735 (patch)
tree9ee8208bc63a09ce1fc9031ffc7123b06ce77b9c /shell/ash.c
parent4a9ca13fe7587314aa55a800c86e20fc21d8f2b1 (diff)
downloadbusybox-9bc80d7062a01aa310be0729c095ba6b652c4735.zip
busybox-9bc80d7062a01aa310be0729c095ba6b652c4735.tar.gz
ash: add FEATURE_SH_NOFORK support
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 0872e68..cc61401 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -8747,6 +8747,24 @@ evalcommand(union node *cmd, int flags)
/* Execute the command. */
switch (cmdentry.cmdtype) {
default:
+
+#if ENABLE_FEATURE_SH_NOFORK
+ {
+ /* TODO: don't rerun find_applet_by_name, find_command
+ * already did it. Make it save applet_no somewhere */
+ int applet_no = find_applet_by_name(argv[0]);
+ if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) {
+ struct nofork_save_area nofork_save;
+
+ listsetvar(varlist.list, VEXPORT|VSTACK);
+ save_nofork_data(&nofork_save);
+ /* run <applet>_main(), then restore nofork_save_area */
+ exitstatus = run_nofork_applet_prime(&nofork_save, applet_no, argv) & 0xff;
+ break;
+ }
+ }
+#endif
+
/* Fork off a child process if necessary. */
if (!(flags & EV_EXIT) || trap[0]) {
INT_OFF;