← Commit list

0b6ec06be

Ron Yorston
Ron Yorston
2017-08-28
SUCCESS Duration: 145s

Subject

kill: add '--' option to separate options from arguments

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/kill.c+5 -0
@@ -184,6 +184,10 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
if (is_killall5 && arg[0] == 'o')
goto do_it_now;
+ /* "--" separates options from args. Testcase: "kill -- -123" */
+ if (!is_killall5 && arg[0] == '-' && arg[1] == '\0')
+ goto do_it_sooner;
+
if (argv[1] && arg[0] == 's' && arg[1] == '\0') { /* -s SIG? */
arg = *++argv;
} /* else it must be -SIG */
@@ -192,6 +196,7 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
bb_error_msg("bad signal name '%s'", arg);
return EXIT_FAILURE;
}
+ do_it_sooner:
arg = *++argv;
do_it_now: