summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen2000-02-24 18:09:58 +0000
committerErik Andersen2000-02-24 18:09:58 +0000
commita51ecdd9e4025d072d2737d6bea8a1d03bc74274 (patch)
treec9a3a179b8e9d2f149d63e9eeddfe9331f9b66db
parent5b911ddd577373dfcbd3d2dade7089ff611ea35e (diff)
downloadbusybox-a51ecdd9e4025d072d2737d6bea8a1d03bc74274.zip
busybox-a51ecdd9e4025d072d2737d6bea8a1d03bc74274.tar.gz
Minor tweak to argv[0] handling for linuxrc
-Erik
-rw-r--r--init.c14
-rw-r--r--init/init.c14
2 files changed, 20 insertions, 8 deletions
diff --git a/init.c b/init.c
index 6ec8115..1837391 100644
--- a/init.c
+++ b/init.c
@@ -803,10 +803,16 @@ extern int init_main(int argc, char **argv)
int status;
#ifndef DEBUG_INIT
- /* Expect to be PID 1 if we are run as init (not linuxrc) */
- if (getpid() != 1 && strstr(argv[0], "init") != NULL) {
- usage("init\n\nInit is the parent of all processes.\n\n"
- "This version of init is designed to be run only by the kernel\n");
+ /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
+ if (getpid() != 1
+#ifdef BB_FEATURE_LINUXRC
+ && strstr(argv[0], "linuxrc") == NULL
+#endif
+ )
+ {
+ usage("init\n\nInit is the parent of all processes.\n\n"
+ "This version of init is designed to be run only "
+ "by the kernel.\n");
}
/* Set up sig handlers -- be sure to
* clear all of these in run() */
diff --git a/init/init.c b/init/init.c
index 6ec8115..1837391 100644
--- a/init/init.c
+++ b/init/init.c
@@ -803,10 +803,16 @@ extern int init_main(int argc, char **argv)
int status;
#ifndef DEBUG_INIT
- /* Expect to be PID 1 if we are run as init (not linuxrc) */
- if (getpid() != 1 && strstr(argv[0], "init") != NULL) {
- usage("init\n\nInit is the parent of all processes.\n\n"
- "This version of init is designed to be run only by the kernel\n");
+ /* Expect to be invoked as init with PID=1 or be invoked as linuxrc */
+ if (getpid() != 1
+#ifdef BB_FEATURE_LINUXRC
+ && strstr(argv[0], "linuxrc") == NULL
+#endif
+ )
+ {
+ usage("init\n\nInit is the parent of all processes.\n\n"
+ "This version of init is designed to be run only "
+ "by the kernel.\n");
}
/* Set up sig handlers -- be sure to
* clear all of these in run() */