kill: Stop processing if a syntactically invalid pid is encountered.
So a command like kill _HUP 1 now fails without sending SIGTERM to init. The behaviour when kill(2) fails remains unchanged: processing continues. This matches other implementations and POSIX and is useful for killing multiple processes at once when some of them may already be gone. PR: bin/40282
This commit is contained in:
parent
8a5216d5d8
commit
9e7839f632
@ -123,10 +123,9 @@ main(int argc, char *argv[])
|
||||
|
||||
for (errors = 0; argc; argc--, argv++) {
|
||||
pid = strtol(*argv, &ep, 10);
|
||||
if (!**argv || *ep) {
|
||||
warnx("illegal process id: %s", *argv);
|
||||
errors = 1;
|
||||
} else if (kill(pid, numsig) == -1) {
|
||||
if (!**argv || *ep)
|
||||
errx(1, "illegal process id: %s", *argv);
|
||||
else if (kill(pid, numsig) == -1) {
|
||||
warn("%s", *argv);
|
||||
errors = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user