Add BB_EXEC[LV]P() which encapsulate FEATURE_EXEC_PREFER_APPLETS

(patch from Gabriel L. Somlo <somlo@cmu.edu>)
This commit is contained in:
Denis Vlasenko
2007-02-03 02:17:41 +00:00
parent 0aa8490693
commit 4921b54f37
3 changed files with 14 additions and 19 deletions

View File

@@ -184,17 +184,13 @@ pid_t spawn(char **argv)
/* Why static? */
static int failed;
pid_t pid;
const char *prog;
// Be nice to nommu machines.
failed = 0;
pid = vfork();
if (pid < 0) return pid;
if (!pid) {
prog = argv[0];
if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && find_applet_by_name(prog))
prog = CONFIG_BUSYBOX_EXEC_PATH;
execvp(prog, argv);
BB_EXECVP(argv[0], argv);
// We're sharing a stack with blocked parent, let parent know we failed
// and then exit to unblock parent (but don't run atexit() stuff, which