]> granicus.if.org Git - procps-ng/commitdiff
skill: fix command line with signal
authorCraig Small <csmall@enc.com.au>
Sat, 24 Jan 2015 06:11:11 +0000 (17:11 +1100)
committerCraig Small <csmall@enc.com.au>
Sat, 24 Jan 2015 06:11:11 +0000 (17:11 +1100)
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>
NEWS
skill.c

diff --git a/NEWS b/NEWS
index 93ddb2cd36feae49311a0ad07a02b13818965a89..55981d44565ab5e90e04c7beeb2f093c1a3c7224 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -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
 ----------------
diff --git a/skill.c b/skill.c
index 2b1ce2f1db044bf112a3c2e57397f59edb5bdd7c..9a19a8bbd8a64eb5a0af5a370f75c4b889f6ee71 100644 (file)
--- a/skill.c
+++ b/skill.c
@@ -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;