Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Dec 2002 00:40:02 -0800 (PST)
From:      stacey <stacey_@starwhack.net>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/46107: killall(1) can prematurely kill itself
Message-ID:  <200212090840.gB98e242091371@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/46107; it has been noted by GNATS.

From: stacey <stacey_@starwhack.net>
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200212090840.gB98e242091371>