From: Filipe Brandenburger Date: Fri, 5 Jun 2015 05:27:03 +0000 (-0700) Subject: kill: print usage if no pid is passed in command line X-Git-Tag: v3.3.11~22^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=27b2937d2d4151d595c1170fb9381d5a0a0f67da;p=procps-ng kill: print usage if no pid is passed in command line This makes a command such as `kill -TERM` or `kill -9` fails and prints usage, instead of silently succeeding. The behavior is consistent with how `kill` behaves without an explicit signal, or with the behavior of the `kill` builtin in a shell like bash. Signed-off-by: Filipe Brandenburger --- diff --git a/skill.c b/skill.c index 9e499739..f8f4e499 100644 --- a/skill.c +++ b/skill.c @@ -493,6 +493,9 @@ static void __attribute__ ((__noreturn__)) argc -= optind; argv += optind; + if (argc < 1) + kill_usage(stderr); + for (i = 0; i < argc; i++) { pid = strtol_or_err(argv[i], _("failed to parse argument")); if (!kill((pid_t) pid, signo))