From owner-freebsd-bugs Fri Feb 14 11:30: 7 2003 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4488737B401 for ; Fri, 14 Feb 2003 11:30:05 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 664C743FAF for ; Fri, 14 Feb 2003 11:30:04 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id h1EJU4NS004658 for ; Fri, 14 Feb 2003 11:30:04 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id h1EJU4C6004657; Fri, 14 Feb 2003 11:30:04 -0800 (PST) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 57E1537B401 for ; Fri, 14 Feb 2003 11:27:14 -0800 (PST) Received: from purge.bash.sh (purge.bash.sh [62.253.236.247]) by mx1.FreeBSD.org (Postfix) with ESMTP id CA6D643F75 for ; Fri, 14 Feb 2003 11:27:13 -0800 (PST) (envelope-from zak@purge.bash.sh) Received: from zak by purge.bash.sh with local (Exim 3.36 #1 (Debian)) id 18jlUO-0001t1-00 for ; Fri, 14 Feb 2003 19:27:12 +0000 Message-Id: <20030214192712.GA7047@purge.bash.sh> Date: Fri, 14 Feb 2003 19:27:12 +0000 From: stacey_ Reply-To: stacey To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Subject: bin/48285: [PATCH] killall(1) suicides before killing matching processes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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