procps/0033-kill-for-PID-1-restored.patch

42 lines
1.2 KiB
Diff

From 4359cf069819d9fb53493933e00d9af5c37bced5 Mon Sep 17 00:00:00 2001
From: Craig Small <csmall@enc.com.au>
Date: Tue, 28 Jan 2014 22:35:26 +1100
Subject: [PATCH] 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>
---
skill.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git skill.c skill.c
index 5c8192a..1c99985 100644
--- skill.c
+++ skill.c
@@ -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);
--
1.7.9.2