From owner-freebsd-bugs Fri Jan 31 16:10:09 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id QAA21547 for bugs-outgoing; Fri, 31 Jan 1997 16:10:09 -0800 (PST) Received: (from gnats@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id QAA21534; Fri, 31 Jan 1997 16:10:04 -0800 (PST) Resent-Date: Fri, 31 Jan 1997 16:10:04 -0800 (PST) Resent-Message-Id: <199702010010.QAA21534@freefall.freebsd.org> Resent-From: gnats (GNATS Management) Resent-To: freebsd-bugs Resent-Reply-To: FreeBSD-gnats@freefall.FreeBSD.org, arnej@imf.unit.no Received: from romberg.imf.unit.no (0@romberg.imf.unit.no [129.241.15.150]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id QAA21318 for ; Fri, 31 Jan 1997 16:06:47 -0800 (PST) Received: from frida.imf.unit.no (frida.imf.unit.no [129.241.15.136]) by romberg.imf.unit.no (8.8.3/8.7.3) with ESMTP id BAA03799; Sat, 1 Feb 1997 01:06:38 +0100 (MET) Received: (from arnej@localhost) by frida.imf.unit.no (8.8.4/8.8.4) id BAA09221; Sat, 1 Feb 1997 01:06:38 +0100 (CET) Message-Id: <199702010006.BAA09221@frida.imf.unit.no> Date: Sat, 1 Feb 1997 01:06:38 +0100 (CET) From: Arne Henrik Juul Reply-To: arnej@imf.unit.no To: FreeBSD-gnats-submit@freebsd.org Cc: arnej@imf.unit.no, jarle@runit.sintef.no, he@runit.sintef.no, tegge@idt.unit.no X-Send-Pr-Version: 3.2 Subject: bin/2631: kill interprets empty arg as PID 0 Sender: owner-bugs@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >Number: 2631 >Category: bin >Synopsis: kill interprets empty arg as PID 0 >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jan 31 16:10:02 PST 1997 >Last-Modified: >Originator: Arne Henrik Juul >Organization: Norwegian University of Technology and Science >Release: FreeBSD 2.2-GAMMA i386 >Environment: This applies to /bin/kill, not the csh kill builtin. >Description: When /bin/kill is given an empty argument, this is converted to PID 0, with unpleasant effects on kill's process group. >How-To-Repeat: /bin/kill -CONT '' Note that you should have got an error. >Fix: A simple typo of !*argv where !**argv was clearly meant. There was another check of the same type, but that one was clearly unneccessary and I've just removed it. Index: kill.c =================================================================== RCS file: /usr/cvs/src/bin/kill/kill.c,v retrieving revision 1.3 diff -u -r1.3 kill.c --- kill.c 1995/03/05 21:52:41 1.3 +++ kill.c 1997/01/31 23:50:26 @@ -87,7 +87,7 @@ nosig(*argv); } else if (isdigit(**argv)) { numsig = strtol(*argv, &ep, 10); - if (!*argv || *ep) + if (*ep) errx(1, "illegal signal number: %s", *argv); if (numsig < 0 || numsig > NSIG) nosig(*argv); @@ -101,7 +101,7 @@ for (errors = 0; *argv; ++argv) { pid = strtol(*argv, &ep, 10); - if (!*argv || *ep) { + if (!**argv || *ep) { warnx("illegal process id: %s", *argv); errors = 1; } else if (kill(pid, numsig) == -1) { >Audit-Trail: >Unformatted: