]> granicus.if.org Git - procps-ng/commitdiff
kill: print usage if no pid is passed in command line
authorFilipe Brandenburger <filbranden@google.com>
Mon, 11 Apr 2016 11:04:41 +0000 (21:04 +1000)
committerCraig Small <csmall@enc.com.au>
Mon, 11 Apr 2016 11:04:41 +0000 (21:04 +1000)
Modication of master line patch 27b2937

Signed-off-by: Craig Small <csmall@enc.com.au>
kill.c

diff --git a/kill.c b/kill.c
index 65bb19de1df3a0932bbcbecfe8c2e34364cbd1ec..315422b8a6e03c39379371d4ac42487ef21c4f43 100644 (file)
--- a/kill.c
+++ b/kill.c
@@ -125,6 +125,9 @@ int main(int argc, char **argv)
     argc -= optind;
     argv += optind;
 
+    if (argc < 1)
+        print_usage(stderr);
+
     for (i = 0; i < argc; i++) {
         pid = strtol_or_err(argv[i], _("failed to parse argument"));
         if (!kill((pid_t) pid, signo))