bin/40282: [patch] kill(1) has bad error checking for command line parameters

Jilles Tjoelker jilles at stack.nl
Sun Nov 8 17:20:03 UTC 2009


The following reply was made to PR bin/40282; it has been noted by GNATS.

From: Jilles Tjoelker <jilles at stack.nl>
To: bug-followup at FreeBSD.org, oleg at reis.zp.ua
Cc:  
Subject: Re: bin/40282: [patch] kill(1) has bad error checking for command
	line parameters
Date: Sun, 8 Nov 2009 18:10:31 +0100

 --W/nzBZO5zC0uMSeA
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 So I suggest this patch (EX_USAGE vs 1 can be changed separately).
 
 -- 
 Jilles Tjoelker
 
 --W/nzBZO5zC0uMSeA
 Content-Type: text/x-diff; charset=us-ascii
 Content-Disposition: attachment; filename="kill-stop-on-synerror.patch"
 
 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;
  		}
 
 --W/nzBZO5zC0uMSeA--


More information about the freebsd-bugs mailing list