aboutsummaryrefslogtreecommitdiff
path: root/procps/kill.c
diff options
context:
space:
mode:
Diffstat (limited to 'procps/kill.c')
-rw-r--r--procps/kill.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/procps/kill.c b/procps/kill.c
index 8aa0eb3e2..0b170fa3d 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -167,13 +167,15 @@ int kill_main(int argc, char **argv)
167 /* Stop all processes */ 167 /* Stop all processes */
168 kill(-1, SIGSTOP); 168 kill(-1, SIGSTOP);
169 /* Signal all processes except those in our session */ 169 /* Signal all processes except those in our session */
170 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID))) { 170 while ((p = procps_scan(p, PSSCAN_PID|PSSCAN_SID)) != NULL) {
171 int i; 171 int i;
172 172
173 if (p->sid == (unsigned)sid 173 if (p->sid == (unsigned)sid
174 || p->pid == (unsigned)pid 174 || p->pid == (unsigned)pid
175 || p->pid == 1) 175 || p->pid == 1
176 ) {
176 continue; 177 continue;
178 }
177 179
178 /* All remaining args must be -o PID options. 180 /* All remaining args must be -o PID options.
179 * Check p->pid against them. */ 181 * Check p->pid against them. */
@@ -257,9 +259,10 @@ int kill_main(int argc, char **argv)
257 pid = bb_strtoi(arg, &end, 10); 259 pid = bb_strtoi(arg, &end, 10);
258 if (errno && (errno != EINVAL || *end != ' ')) { 260 if (errno && (errno != EINVAL || *end != ' ')) {
259 bb_error_msg("invalid number '%s'", arg); 261 bb_error_msg("invalid number '%s'", arg);
260 *end = '\0';
261 errors++; 262 errors++;
262 } else if (kill(pid, signo) != 0) { 263 break;
264 }
265 if (kill(pid, signo) != 0) {
263 bb_perror_msg("can't kill pid %d", (int)pid); 266 bb_perror_msg("can't kill pid %d", (int)pid);
264 errors++; 267 errors++;
265 } 268 }