kill for PID -1 restored

Both the man page and the shell builtin kill mention you can
use PID -1, which means nuke everything you can get at.
Alas this "fun" option was missing and the only way to get
around it was with "kill -HUP -- -1".

This small change means kill -HUP -1 is back for all those
destructive types. The error was introduced when the argument
parser was fixed for other problems.

Thanks to Mike for pointing this out.

Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
Craig Small 2014-01-28 22:35:26 +11:00
parent ae9676a337
commit 4359cf0698

View File

@ -477,6 +477,12 @@ static void __attribute__ ((__noreturn__))
display_kill_version();
exit(EXIT_SUCCESS);
case '?':
/* Special case is -1 which means all except init */
if (optopt == '1') {
if (kill(-1, signo) != 0)
exitvalue = EXIT_FAILURE;
exit(exitvalue);
}
if (!isdigit(optopt)) {
xwarnx(_("invalid argument %c"), optopt);
kill_usage(stderr);