diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index 3adb6d0d2..58ecf6d2c 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -8085,6 +8085,9 @@ static void shellexec(char *prog, char **argv, const char *path, int idx) | |||
8085 | if (strchr(prog, '/') != NULL | 8085 | if (strchr(prog, '/') != NULL |
8086 | #if ENABLE_FEATURE_SH_STANDALONE | 8086 | #if ENABLE_FEATURE_SH_STANDALONE |
8087 | || (applet_no = find_applet_by_name(prog)) >= 0 | 8087 | || (applet_no = find_applet_by_name(prog)) >= 0 |
8088 | # if NUM_SCRIPTS > 0 | ||
8089 | || (applet_no = NUM_APPLETS + find_script_by_name(prog)) >= 0 | ||
8090 | # endif | ||
8088 | #endif | 8091 | #endif |
8089 | ) { | 8092 | ) { |
8090 | tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) prog, argv, envp); | 8093 | tryexec(IF_FEATURE_SH_STANDALONE(applet_no,) prog, argv, envp); |
@@ -10186,6 +10189,10 @@ evalcommand(union node *cmd, int flags) | |||
10186 | */ | 10189 | */ |
10187 | /* find_command() encodes applet_no as (-2 - applet_no) */ | 10190 | /* find_command() encodes applet_no as (-2 - applet_no) */ |
10188 | int applet_no = (- cmdentry.u.index - 2); | 10191 | int applet_no = (- cmdentry.u.index - 2); |
10192 | # if NUM_SCRIPTS > 0 | ||
10193 | /* Applets are ok, but not embedded scripts */ | ||
10194 | if (applet_no < NUM_APPLETS) | ||
10195 | # endif | ||
10189 | if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) { | 10196 | if (applet_no >= 0 && APPLET_IS_NOFORK(applet_no)) { |
10190 | char **sv_environ; | 10197 | char **sv_environ; |
10191 | 10198 | ||
@@ -13368,6 +13375,11 @@ find_command(char *name, struct cmdentry *entry, int act, const char *path) | |||
13368 | #if ENABLE_FEATURE_SH_STANDALONE | 13375 | #if ENABLE_FEATURE_SH_STANDALONE |
13369 | { | 13376 | { |
13370 | int applet_no = find_applet_by_name(name); | 13377 | int applet_no = find_applet_by_name(name); |
13378 | # if NUM_SCRIPTS > 0 | ||
13379 | if (applet_no < 0) | ||
13380 | /* embedded script indices are offset by NUM_APPLETS */ | ||
13381 | applet_no = NUM_APPLETS + find_script_by_name(name); | ||
13382 | # endif | ||
13371 | if (applet_no >= 0) { | 13383 | if (applet_no >= 0) { |
13372 | entry->cmdtype = CMDNORMAL; | 13384 | entry->cmdtype = CMDNORMAL; |
13373 | entry->u.index = -2 - applet_no; | 13385 | entry->u.index = -2 - applet_no; |