Teach 'init -q' that init's pid may not equal 1

This commit is contained in:
Eric Andersen 2002-01-25 23:13:06 +00:00
parent a3181dd833
commit 467a18b1d9

View File

@ -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);
}