kill: print usage if no pid is passed in command line

Modication of master line patch 27b2937

Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
Filipe Brandenburger 2016-04-11 21:04:41 +10:00 committed by Craig Small
parent 6586f9f9ce
commit 8d6466a48d

3
kill.c
View File

@ -125,6 +125,9 @@ int main(int argc, char **argv)
argc -= optind; argc -= optind;
argv += optind; argv += optind;
if (argc < 1)
print_usage(stderr);
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
pid = strtol_or_err(argv[i], _("failed to parse argument")); pid = strtol_or_err(argv[i], _("failed to parse argument"));
if (!kill((pid_t) pid, signo)) if (!kill((pid_t) pid, signo))