Date: Fri, 14 Feb 2003 19:27:12 +0000 From: stacey_ <duqz@starwhack.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: bin/48285: [PATCH] killall(1) suicides before killing matching processes Message-ID: <20030214192712.GA7047@purge.bash.sh>
next in thread | raw e-mail | index | archive | help
>Number: 48285
>Category: bin
>Synopsis: [PATCH] killall(1) suicides before killing matching processes
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Fri Feb 14 11:30:03 PST 2003
>Closed-Date:
>Last-Modified:
>Originator: stacey
>Release: FreeBSD 5.0-RELEASE i386
>Organization:
>Environment:
System: FreeBSD heaven 5.0-RELEASE FreeBSD 5.0-RELEASE #0: Tue Feb 4 23:56:36 GMT 2003 root@heaven:/usr/obj/usr/src/sys/HEAVEN i386
>Description:
killall(1) suicides
>How-To-Repeat:
$ ps | grep killall
90795 p1 T 0:00.12 killall ducks
90797 p1 T 0:00.05 killall go
90800 p1 T 0:00.05 killall wak wak
90809 p1 R+ 0:00.06 grep killall
$ killall -KILL -v killall
kill -KILL 90810
Killed
>Fix:
--- killall.c Wed Feb 5 14:20:27 2003
+++ killall.c Sun Feb 9 20:47:37 2003
@@ -114,6 +114,7 @@
int zflag = 0;
uid_t uid = 0;
dev_t tdev = 0;
+ pid_t mypid;
char thiscmd[MAXCOMLEN + 1];
pid_t thispid;
uid_t thisuid;
@@ -285,6 +286,7 @@
nprocs = size / sizeof(struct kinfo_proc);
if (dflag)
printf("nprocs %d\n", nprocs);
+ mypid = getpid();
for (i = 0; i < nprocs; i++) {
if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag)
@@ -295,6 +297,8 @@
thistdev = procs[i].ki_tdev;
thisuid = procs[i].ki_ruid; /* real uid */
+ if (thispid == mypid)
+ continue;
matched = 1;
if (user) {
if (thisuid != uid)
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030214192712.GA7047>
