skill: fix command line with signal

If skill was used with a signal number then it would intepret
the command line with last option interpreted twice. This often
confused the program so it just would end up killing nothing.
So this would work:
skill -t pts/0
This would not:
skill -9 -t pts/0

The kill path (in the same file) uses the same logic that has
been introduced here.

References: https://www.freelists.org/post/procps/skill-command-does-not-work-in-debian-7-releases

    Signed-off-by: Craig Small <csmall@enc.com.au>
This commit is contained in:
Craig Small 2015-01-24 17:11:11 +11:00
parent fc7cb8dd4c
commit 7610b3128e
2 changed files with 4 additions and 1 deletions

1
NEWS
View File

@ -1,6 +1,7 @@
procps-ng-NEXT
----------------
* pgrep: don't crash with -a -w flags. Merge 33, Debian #768190
* skill: command line with signal number interpreted correctly
procps-ng-3.3.10
----------------

View File

@ -588,8 +588,10 @@ static void skillsnice_parse(int argc,
prino = snice_prio_option(&argc, argv);
else if (program == PROG_SKILL) {
signo = skill_sig_option(&argc, argv);
if (-1 < signo)
if (-1 < signo) {
sig_or_pri = signo;
argc -= 1;
}
}
pid_count = 0;