Fix STANDALONE_SHELL and ALWAYS_WIN options, last_path_73 by Vladimir N. Oleynik
This commit is contained in:
parent
0a65e190f4
commit
c00c56e7c8
32
shell/ash.c
32
shell/ash.c
@ -3280,20 +3280,34 @@ static void tryexec(char *cmd, char **argv, char **envp)
|
|||||||
int repeated = 0;
|
int repeated = 0;
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
|
#ifdef CONFIG_FEATURE_SH_STANDALONE_SHELL
|
||||||
|
int flg_bb = 0;
|
||||||
char *name = cmd;
|
char *name = cmd;
|
||||||
char **argv_l = argv;
|
|
||||||
int argc_l;
|
|
||||||
|
|
||||||
#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
|
#ifdef CONFIG_FEATURE_SH_APPLETS_ALWAYS_WIN
|
||||||
name = get_last_path_component(name);
|
name = get_last_path_component(name);
|
||||||
|
if(find_applet_by_name(name) != NULL)
|
||||||
|
flg_bb = 1;
|
||||||
|
#else
|
||||||
|
if(strchr(name, '/') == NULL && find_applet_by_name(name) != NULL) {
|
||||||
|
flg_bb = 1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
argv_l = envp;
|
if(flg_bb) {
|
||||||
for (argc_l = 0; *argv_l != NULL; argv_l++, argc_l++)
|
char **ap;
|
||||||
putenv(*argv_l);
|
char **new;
|
||||||
argv_l = argv;
|
|
||||||
for (argc_l = 0; *argv_l != NULL; argv_l++, argc_l++)
|
*argv = name;
|
||||||
optind = 1;
|
if(strcmp(name, "busybox")) {
|
||||||
run_applet_by_name(name, argc_l, argv);
|
for (ap = argv; *ap; ap++);
|
||||||
|
ap = new = xmalloc((ap - argv + 2) * sizeof(char *));
|
||||||
|
*ap++ = cmd = "/bin/busybox";
|
||||||
|
while ((*ap++ = *argv++));
|
||||||
|
argv = new;
|
||||||
|
repeated++;
|
||||||
|
} else {
|
||||||
|
cmd = "/bin/busybox";
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
repeat:
|
repeat:
|
||||||
execve(cmd, argv, envp);
|
execve(cmd, argv, envp);
|
||||||
|
Loading…
Reference in New Issue
Block a user