[PATCH] kill: use --queue option argument as sigval integer value

Sami Kerola
2014-07-09T20:49:11Z

The sigqueue(3) takes two values, signal and sigval. Contents of the
signal can be altered with --signal option argument, so the --queue
argument should be reserved to affect sigval_int.

This is regression fix introduced by commit
9e8dffd5cd29f03029b1ac99eecb129532ca5c0f.

Reference: http://man7.org/linux/man-pages/man3/sigqueue.3.html
Reported-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
---
misc-utils/kill.c | 4 +---
tests/ts/kill/options | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/misc-utils/kill.c b/misc-utils/kill.c
index f2362c3..2f89427 100644
--- a/misc-utils/kill.c
+++ b/misc-utils/kill.c
@@ -412,9 +412,7 @@ static char **parse_arguments(int argc, char **argv, struct kill_control *ctl)
errx(EXIT_FAILURE, _("%s and %s are mutually exclusive"), "--pid", "--queue");
argc--, argv++;
arg = *argv;
- if ((ctl->numsig = arg_to_signum(arg, 0)) < 0)
- err_nosig(arg);
- ctl->sigdata.sival_int = ctl->numsig;
+ ctl->sigdata.sival_int = strtos32_or_err(arg, _("argument error"));
ctl->use_sigval = 1;
continue;
}
diff --git a/tests/ts/kill/options b/tests/ts/kill/options
index 6cdaa24..5af78d9 100755
--- a/tests/ts/kill/options
+++ b/tests/ts/kill/options
@@ -51,8 +51,8 @@ try_option -s 1
try_option --signal 1
try_option --signal HUP
try_option --signal SIGHUP
-try_option -q HUP
-try_option --queue HUP
+try_option -s 1 -q 42
+try_option -s 1 --queue 42
try_option -1
try_option -HUP
try_option -SIGHUP
--
2.0.1