From owner-freebsd-bugs@FreeBSD.ORG Sun Nov 8 17:20:03 2009 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8FB1B1065670 for ; Sun, 8 Nov 2009 17:20:03 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 7F0F88FC21 for ; Sun, 8 Nov 2009 17:20:03 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.3/8.14.3) with ESMTP id nA8HK3kZ024300 for ; Sun, 8 Nov 2009 17:20:03 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.3/8.14.3/Submit) id nA8HK3FH024299; Sun, 8 Nov 2009 17:20:03 GMT (envelope-from gnats) Date: Sun, 8 Nov 2009 17:20:03 GMT Message-Id: <200911081720.nA8HK3FH024299@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Jilles Tjoelker Cc: Subject: Re: bin/40282: [patch] kill(1) has bad error checking for command line parameters X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Jilles Tjoelker List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Nov 2009 17:20:03 -0000 The following reply was made to PR bin/40282; it has been noted by GNATS. From: Jilles Tjoelker To: bug-followup@FreeBSD.org, oleg@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--