summaryrefslogtreecommitdiff
path: root/init/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'init/init.c')
-rw-r--r--init/init.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c
index 79a7484..e48dc50 100644
--- a/init/init.c
+++ b/init/init.c
@@ -963,7 +963,14 @@ extern int init_main(int argc, char **argv)
if (argc > 1 && !strcmp(argv[1], "-q")) {
- kill(1, SIGHUP);
+ /* don't assume init's pid == 1 */
+ long *pid = find_pid_by_name("init");
+ if (!pid || *pid<=0) {
+ pid = find_pid_by_name("linuxrc");
+ if (!pid || *pid<=0)
+ error_msg_and_die("no process killed");
+ }
+ kill(*pid, SIGHUP);
exit(0);
}