Date: Sat, 1 Feb 1997 01:06:38 +0100 (CET) From: Arne Henrik Juul <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 Subject: bin/2631: kill interprets empty arg as PID 0 Message-ID: <199702010006.BAA09221@frida.imf.unit.no> Resent-Message-ID: <199702010010.QAA21534@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>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:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199702010006.BAA09221>