diff options
| author | Eric Andersen <andersen@codepoet.org> | 2002-01-25 23:13:06 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2002-01-25 23:13:06 +0000 |
| commit | 467a18b1d94dbcdc9f750e52d09f6579037fbff5 (patch) | |
| tree | 19d3fa1979344dd4596fc6bda470506e9200c14c /init | |
| parent | a3181dd833970b1aa99087c3e3647387116547f0 (diff) | |
| download | busybox-w32-467a18b1d94dbcdc9f750e52d09f6579037fbff5.tar.gz busybox-w32-467a18b1d94dbcdc9f750e52d09f6579037fbff5.tar.bz2 busybox-w32-467a18b1d94dbcdc9f750e52d09f6579037fbff5.zip | |
Teach 'init -q' that init's pid may not equal 1
Diffstat (limited to 'init')
| -rw-r--r-- | init/init.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/init/init.c b/init/init.c index 79a748454..e48dc50cc 100644 --- a/init/init.c +++ b/init/init.c | |||
| @@ -963,7 +963,14 @@ extern int init_main(int argc, char **argv) | |||
| 963 | 963 | ||
| 964 | 964 | ||
| 965 | if (argc > 1 && !strcmp(argv[1], "-q")) { | 965 | if (argc > 1 && !strcmp(argv[1], "-q")) { |
| 966 | kill(1, SIGHUP); | 966 | /* don't assume init's pid == 1 */ |
| 967 | long *pid = find_pid_by_name("init"); | ||
| 968 | if (!pid || *pid<=0) { | ||
| 969 | pid = find_pid_by_name("linuxrc"); | ||
| 970 | if (!pid || *pid<=0) | ||
| 971 | error_msg_and_die("no process killed"); | ||
| 972 | } | ||
| 973 | kill(*pid, SIGHUP); | ||
| 967 | exit(0); | 974 | exit(0); |
| 968 | } | 975 | } |
| 969 | 976 | ||
