diff options
author | Mike Pechkin <mpech@cvs.openbsd.org> | 2004-07-15 13:55:11 +0000 |
---|---|---|
committer | Mike Pechkin <mpech@cvs.openbsd.org> | 2004-07-15 13:55:11 +0000 |
commit | aac26a1826da28175b40d5910eab414b7ea61f9d (patch) | |
tree | 7a5bde9378bfc1b0a0a1314ce39a8361f8a5e84d /usr.bin | |
parent | fa39335c91eba94f51b98c705963dcf3fa914817 (diff) |
Skip SYSTEM and ourown proccess on every loop.
millert@, otto@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/pkill/pkill.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c index e1cd68fc0c3..fadfdefc3b1 100644 --- a/usr.bin/pkill/pkill.c +++ b/usr.bin/pkill/pkill.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkill.c,v 1.4 2004/06/24 18:04:45 millert Exp $ */ +/* $OpenBSD: pkill.c,v 1.5 2004/07/15 13:55:10 mpech Exp $ */ /* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */ /*- @@ -38,7 +38,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: pkill.c,v 1.4 2004/06/24 18:04:45 millert Exp $"; +static const char rcsid[] = "$OpenBSD: pkill.c,v 1.5 2004/07/15 13:55:10 mpech Exp $"; #endif /* !lint */ #include <sys/types.h> @@ -291,7 +291,7 @@ main(int argc, char **argv) } for (i = 0, kp = plist; i < nproc; i++, kp++) { - if ((kp->p_flag & P_SYSTEM) != 0) + if ((kp->p_flag & P_SYSTEM) != 0 || kp->p_pid == mypid) continue; SLIST_FOREACH(li, &ruidlist, li_chain) @@ -385,7 +385,7 @@ main(int argc, char **argv) * Take the appropriate action for each matched process, if any. */ for (i = 0, rv = STATUS_NOMATCH, kp = plist; i < nproc; i++, kp++) { - if (kp->p_pid == mypid) + if ((kp->p_flag & P_SYSTEM) != 0 || kp->p_pid == mypid) continue; if (selected[i]) { if (inverse) @@ -393,9 +393,6 @@ main(int argc, char **argv) } else if (!inverse) continue; - if ((kp->p_flag & P_SYSTEM) != 0) - continue; - if ((*action)(kp) == -1) rv = STATUS_ERROR; else if (rv != STATUS_ERROR) |