From 85378253f3569bb27562c82a7761817a2c3c1855 Mon Sep 17 00:00:00 2001 From: Sergey Bolshakov Date: Mon, 6 Jul 2009 19:22:03 +0400 Subject: [PATCH] mostly formatting --- init.c | 9 ++++----- stage1.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/init.c b/init.c index 00f7069..998ccb3 100644 --- a/init.c +++ b/init.c @@ -574,11 +574,9 @@ int main(int argc, char **argv) /* Check for given init */ init = get_from_env("INIT", myenv); - if ( init && ! stat(init, &ist) && S_ISREG(ist.st_mode)) - argv[0] = init; - else if ( ! stat(STAGE2_BINNAME, &ist) && S_ISREG(ist.st_mode)) - argv[0] = STAGE2_BINNAME; - else + if (init == NULL) init = STAGE2_BINNAME; + + if (stat(init, &ist) || !S_ISREG(ist.st_mode) || !(ist.st_mode & S_IXUSR)) fatal("can't find init on root fs"); /* Spawn init */ @@ -587,6 +585,7 @@ int main(int argc, char **argv) /* unblock signals */ sigprocmask(SIG_UNBLOCK, &sig, NULL); + argv[0] = init; execve(argv[0], argv, myenv); fatal("stage2"); /* Failed to spawn init */ return 0; diff --git a/stage1.c b/stage1.c index efa0251..3ead7e5 100644 --- a/stage1.c +++ b/stage1.c @@ -329,7 +329,7 @@ void stage1() { enum return_type ret; char buf[128]; - char * init; + char *init; open_log(); getversion();