diff options
author | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-03-13 09:44:50 +0000 |
---|---|---|
committer | Stuart Henderson <sthen@cvs.openbsd.org> | 2012-03-13 09:44:50 +0000 |
commit | d69400fd34a135f01b73889a10aa7e77a64f9403 (patch) | |
tree | eb633b0e057e71d7c28534227e4daa82f99bcc4e /usr.bin/pkill | |
parent | bc93e0caf2df9d1d5af3f3ea6dfff0b71cd9b296 (diff) |
Teach pgrep/pkill to only match processes, not threads. ok guenther@
Diffstat (limited to 'usr.bin/pkill')
-rw-r--r-- | usr.bin/pkill/pkill.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/pkill/pkill.c b/usr.bin/pkill/pkill.c index 531576b9a63..34681f4fc2e 100644 --- a/usr.bin/pkill/pkill.c +++ b/usr.bin/pkill/pkill.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pkill.c,v 1.24 2012/03/01 13:04:29 lum Exp $ */ +/* $OpenBSD: pkill.c,v 1.25 2012/03/13 09:44:49 sthen Exp $ */ /* $NetBSD: pkill.c,v 1.5 2002/10/27 11:49:34 kleink Exp $ */ /*- @@ -254,7 +254,8 @@ main(int argc, char **argv) } for (i = 0, kp = plist; i < nproc; i++, kp++) { - if ((kp->p_flag & P_SYSTEM) != 0 || kp->p_pid == mypid) + if ((kp->p_flag & (P_SYSTEM | P_THREAD)) != 0 || + kp->p_pid == mypid) continue; if (matchargs) { @@ -297,7 +298,8 @@ main(int argc, char **argv) } for (i = 0, kp = plist; i < nproc; i++, kp++) { - if ((kp->p_flag & P_SYSTEM) != 0 || kp->p_pid == mypid) + if ((kp->p_flag & (P_SYSTEM | P_THREAD)) != 0 || + kp->p_pid == mypid) continue; SLIST_FOREACH(li, &ruidlist, li_chain) @@ -407,7 +409,8 @@ main(int argc, char **argv) */ rv = STATUS_NOMATCH; for (i = 0, j = 0, kp = plist; i < nproc; i++, kp++) { - if ((kp->p_flag & P_SYSTEM) != 0 || kp->p_pid == mypid) + if ((kp->p_flag & (P_SYSTEM | P_THREAD)) != 0 || + kp->p_pid == mypid) continue; if (selected[i]) { if (longfmt && !pgrep) |