kill: -l space between name parses correctly

kill -lHUP would work correctly, but kill -l HUP would not.

The list option in kill was hit by a quirk of getopt_long where an
option with an optional argument would not attempt to get the argument
beyond the space, even though a mandatory argument would do that.

The fix is a kludge to scan to the next argument and if it looks
like something we can use, use it. Lucky for us, the list option is
one where parsing can stop immediately.

Thanks to Brian Vandenberg for the way forward.

References:
 http://stackoverflow.com/questions/1052746/getopt-does-not-parse-optional-arguments-to-parameters
 https://bugs.debian.org/854407
This commit is contained in:
Craig Small
2017-02-07 22:05:18 +11:00
parent 625d0809da
commit 536cea324b
3 changed files with 29 additions and 7 deletions

1
NEWS
View File

@@ -10,6 +10,7 @@ procps-ng-NEXT
* top: add config file support for XDG specification
* pgrep: warn about 15+ char name only if -f not used
* pkill: Return 0 only if we can kill process Debian #852758
* kill: -l space between name parses correctly Debian #854407
procps-ng-3.3.12
----------------