From owner-freebsd-bugs Mon Dec 9 0:40: 6 2002 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 A967837B401 for ; Mon, 9 Dec 2002 00:40:04 -0800 (PST) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6190943EA9 for ; Mon, 9 Dec 2002 00:40:03 -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 gB98e3x3091372 for ; Mon, 9 Dec 2002 00:40:03 -0800 (PST) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id gB98e242091371; Mon, 9 Dec 2002 00:40:02 -0800 (PST) Date: Mon, 9 Dec 2002 00:40:02 -0800 (PST) Message-Id: <200212090840.gB98e242091371@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: stacey Subject: Re: bin/46107: killall(1) can prematurely kill itself Reply-To: stacey 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 The following reply was made to PR bin/46107; it has been noted by GNATS. From: stacey To: freebsd-gnats-submit@FreeBSD.org Cc: Subject: Re: bin/46107: killall(1) can prematurely kill itself Date: Mon, 9 Dec 2002 19:29:42 +1100 previous diff has inconsistencies with verbosity options and is just poor in general. :\ Index: killall.c =================================================================== RCS file: /home/stacey_/src/freebsd/src/usr.bin/killall/killall.c,v retrieving revision 1.19 diff -u -r1.19 killall.c --- killall.c 30 Jun 2002 05:25:01 -0000 1.19 +++ killall.c 9 Dec 2002 08:18:47 -0000 @@ -117,6 +117,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; @@ -289,6 +290,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) @@ -299,6 +301,8 @@ thistdev = procs[i].ki_tdev; thisuid = procs[i].ki_ruid; /* real uid */ + if (thispid == mypid) + continue; matched = 1; if (user) { if (thisuid != uid) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message