Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Dec 2009 16:50:03 GMT
From:      "Oleg V. Nauman" <oleg@reis.zp.ua>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters
Message-ID:  <200912011650.nB1Go3R4023037@freefall.freebsd.org>

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

From: "Oleg V. Nauman" <oleg@reis.zp.ua>
To: Jilles Tjoelker <jilles@stack.nl>
Cc: bug-followup@freebsd.org, oleg@reis.zp.ua
Subject: Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters
Date: Tue, 1 Dec 2009 18:14:29 +0200

  Hello Jilles,
 
 Thank you for looking into this.
 
 Your patch is fine, but it raises the next questions: do we really want to 
 keep historical kill(1) behavior regarding processing on the rest of list of 
 PIDs when an error occurs? Both of proposed patches ( mine and you ) just 
 break this historical behavior. Well I think that breaking the ( bad ) things 
 is the fine thing. Please commit your patch. 
 
  Thank you.
 
 On Sunday 08 November 2009 19:10:31 you wrote:
 > So I suggest this patch (EX_USAGE vs 1 can be changed separately).
 > 
 > -- 
 > Jilles Tjoelker
 > 
 > Index: bin/kill/kill.c
 > ===================================================================
 > --- bin/kill/kill.c     (revision 198703)
 > +++ bin/kill/kill.c     (working copy)
 > @@ -123,10 +123,9 @@
 > 
 >         for (errors = 0; argc; argc--, argv++) {
 >                 pid = strtol(*argv, &ep, 10);
 > -               if (!**argv || *ep) {
 > -                       warnx("illegal process id: %s", *argv);
 > -                       errors = 1;
 > -               } else if (kill(pid, numsig) == -1) {
 > +               if (!**argv || *ep)
 > +                       errx(1, "illegal process id: %s", *argv);
 > +               else if (kill(pid, numsig) == -1) {
 >                         warn("%s", *argv);
 >                         errors = 1;
 >                 }
 > 



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