aboutsummaryrefslogtreecommitdiff
path: root/toys
diff options
context:
space:
mode:
Diffstat (limited to 'toys')
-rw-r--r--toys/lsb/killall.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/toys/lsb/killall.c b/toys/lsb/killall.c
index 655ed734..02a20bea 100644
--- a/toys/lsb/killall.c
+++ b/toys/lsb/killall.c
@@ -1,4 +1,3 @@
-
/* killall.c - Send signal (default: TERM) to all processes with given names.
*
* Copyright 2012 Andreas Heck <aheck@gmx.de>
@@ -26,12 +25,15 @@ config KILLALL
GLOBALS(
int signum;
+ pid_t cur_pid;
)
static int kill_process(pid_t pid, char *name)
{
int ret;
+ if (pid == TT.cur_pid) return 1;
+
if(toys.optflags & FLAG_i) {
snprintf(toybuf, sizeof(toybuf), "Signal %s(%d) ?", name, pid);
if (yesno(toybuf, 0) == 0) return 1;
@@ -79,6 +81,8 @@ void killall_main(void)
}
}
+ TT.cur_pid = getpid();
+
for_each_pid_with_name_in(names, kill_process);
if (toys.exitval && !(toys.optflags & FLAG_q)) error_exit("No such process");