]> granicus.if.org Git - procps-ng/commit
skill: fix command line with signal, again
authorFilipe Brandenburger <filbranden@google.com>
Fri, 5 Jun 2015 05:07:49 +0000 (22:07 -0700)
committerFilipe Brandenburger <filbranden@google.com>
Tue, 7 Jul 2015 17:39:49 +0000 (10:39 -0700)
commitd1d2ccf732fec40e0d48640f1d23a476a002d987
tree6b601ffda3338c8a8fd023aa7d5f255fb47fe194
parent2617d03a33a2e68a6ee6fed2278fcac6a3fb59b4
skill: fix command line with signal, again

Have skill_sig_option sanitize the command line by properly decrementing
*argc after moving the arguments to remove the -signal one.

One bug caused by this issue was when running `kill -1`, then the code
would interpret -1 as both SIGHUP and as process group -1 and send
SIGHUP to all of them. Or `kill -28` which would send SIGWINCH to
process group -2 (in another bug, the -pgid support only accepts a
single digit, fix for that bug will follow.)

This also reverts commit 7610b3128e6ac4 ("skill: fix command line with
signal") which worked around this bug in `skill` and also removes the
"sigopt" hack which worked around this bug in `kill`.

The skill_sig_option implementation is compatible with signal_option()
from pgrep.c. I plan to factor them out into a single source file in a
follow up commit, to prevent the duplication.

This commit fixes the issues reported above. I also tested the issues
from commit 7610b3128e6ac4, `skill -9 -t pts/0` works as expected, also
tried `kill` with -signal and a number of pids and it worked as
expected.

Also tested that `make check` and `make distcheck` keep working.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
skill.c