mostly formatting

This commit is contained in:
Sergey Bolshakov 2009-07-06 19:22:03 +04:00
parent 544819c936
commit 85378253f3
2 changed files with 5 additions and 6 deletions

9
init.c
View File

@ -574,11 +574,9 @@ int main(int argc, char **argv)
/* Check for given init */ /* Check for given init */
init = get_from_env("INIT", myenv); init = get_from_env("INIT", myenv);
if ( init && ! stat(init, &ist) && S_ISREG(ist.st_mode)) if (init == NULL) init = STAGE2_BINNAME;
argv[0] = init;
else if ( ! stat(STAGE2_BINNAME, &ist) && S_ISREG(ist.st_mode)) if (stat(init, &ist) || !S_ISREG(ist.st_mode) || !(ist.st_mode & S_IXUSR))
argv[0] = STAGE2_BINNAME;
else
fatal("can't find init on root fs"); fatal("can't find init on root fs");
/* Spawn init */ /* Spawn init */
@ -587,6 +585,7 @@ int main(int argc, char **argv)
/* unblock signals */ /* unblock signals */
sigprocmask(SIG_UNBLOCK, &sig, NULL); sigprocmask(SIG_UNBLOCK, &sig, NULL);
argv[0] = init;
execve(argv[0], argv, myenv); execve(argv[0], argv, myenv);
fatal("stage2"); /* Failed to spawn init */ fatal("stage2"); /* Failed to spawn init */
return 0; return 0;

View File

@ -329,7 +329,7 @@ void stage1()
{ {
enum return_type ret; enum return_type ret;
char buf[128]; char buf[128];
char * init; char *init;
open_log(); open_log();
getversion(); getversion();