aboutsummaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2007-02-03 02:17:41 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2007-02-03 02:17:41 +0000
commit4921b54f37125a58d5ea1a8aac886ae781517bc1 (patch)
treed8a989b6b3c29db835d3ec3084b908b6199d91dc /init/init.c
parent0aa84906936bd99ea8627a24b8ad2fdeedc7e928 (diff)
downloadbusybox-w32-4921b54f37125a58d5ea1a8aac886ae781517bc1.tar.gz
busybox-w32-4921b54f37125a58d5ea1a8aac886ae781517bc1.tar.bz2
busybox-w32-4921b54f37125a58d5ea1a8aac886ae781517bc1.zip
Add BB_EXEC[LV]P() which encapsulate FEATURE_EXEC_PREFER_APPLETS
(patch from Gabriel L. Somlo <somlo@cmu.edu>)
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/init/init.c b/init/init.c
index cb314003e..110af8566 100644
--- a/init/init.c
+++ b/init/init.c
@@ -389,7 +389,6 @@ static pid_t run(const struct init_action *a)
389#include CUSTOMIZED_BANNER 389#include CUSTOMIZED_BANNER
390#endif 390#endif
391 "\nPlease press Enter to activate this console. "; 391 "\nPlease press Enter to activate this console. ";
392 const char *prog;
393 392
394 /* Block sigchild while forking. */ 393 /* Block sigchild while forking. */
395 sigemptyset(&nmask); 394 sigemptyset(&nmask);
@@ -561,10 +560,7 @@ static pid_t run(const struct init_action *a)
561 560
562 /* Now run it. The new program will take over this PID, 561 /* Now run it. The new program will take over this PID,
563 * so nothing further in init.c should be run. */ 562 * so nothing further in init.c should be run. */
564 prog = cmdpath; 563 BB_EXECVP(cmdpath, cmd);
565 if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && find_applet_by_name(prog))
566 prog = CONFIG_BUSYBOX_EXEC_PATH;
567 execvp(prog, cmd);
568 564
569 /* We're still here? Some error happened. */ 565 /* We're still here? Some error happened. */
570 message(LOG | CONSOLE, "Bummer, cannot run '%s': %m", cmdpath); 566 message(LOG | CONSOLE, "Bummer, cannot run '%s': %m", cmdpath);
@@ -682,7 +678,6 @@ static void exec_signal(int sig ATTRIBUTE_UNUSED)
682{ 678{
683 struct init_action *a, *tmp; 679 struct init_action *a, *tmp;
684 sigset_t unblock_signals; 680 sigset_t unblock_signals;
685 char *prog;
686 681
687 for (a = init_action_list; a; a = tmp) { 682 for (a = init_action_list; a; a = tmp) {
688 tmp = a->next; 683 tmp = a->next;
@@ -718,10 +713,7 @@ static void exec_signal(int sig ATTRIBUTE_UNUSED)
718 dup(0); 713 dup(0);
719 714
720 messageD(CONSOLE | LOG, "Trying to re-exec %s", a->command); 715 messageD(CONSOLE | LOG, "Trying to re-exec %s", a->command);
721 prog = a->command; 716 BB_EXECLP(a->command, a->command, NULL);
722 if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && find_applet_by_name(prog))
723 prog = CONFIG_BUSYBOX_EXEC_PATH;
724 execlp(prog, a->command, NULL);
725 717
726 message(CONSOLE | LOG, "exec of '%s' failed: %m", 718 message(CONSOLE | LOG, "exec of '%s' failed: %m",
727 a->command); 719 a->command);
@@ -1076,10 +1068,7 @@ int init_main(int argc, char **argv)
1076 1068
1077 putenv("SELINUX_INIT=YES"); 1069 putenv("SELINUX_INIT=YES");
1078 if (selinux_init_load_policy(&enforce) == 0) { 1070 if (selinux_init_load_policy(&enforce) == 0) {
1079 char *prog = argv[0]; 1071 BB_EXECVP(argv[0], argv);
1080 if (ENABLE_FEATURE_EXEC_PREFER_APPLETS && find_applet_by_name(prog))
1081 prog = CONFIG_BUSYBOX_EXEC_PATH;
1082 execvp(prog, argv);
1083 } else if (enforce > 0) { 1072 } else if (enforce > 0) {
1084 /* SELinux in enforcing mode but load_policy failed */ 1073 /* SELinux in enforcing mode but load_policy failed */
1085 /* At this point, we probably can't open /dev/console, so log() won't work */ 1074 /* At this point, we probably can't open /dev/console, so log() won't work */