commit | 467a18b1d94dbcdc9f750e52d09f6579037fbff5 | [log] [tgz] |
---|---|---|
author | Eric Andersen <andersen@codepoet.org> | Fri Jan 25 23:13:06 2002 +0000 |
committer | Eric Andersen <andersen@codepoet.org> | Fri Jan 25 23:13:06 2002 +0000 |
tree | 19d3fa1979344dd4596fc6bda470506e9200c14c | |
parent | a3181dd833970b1aa99087c3e3647387116547f0 [diff] [blame] |
Teach 'init -q' that init's pid may not equal 1
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 @@ 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); }