diff options
author | Sami Kerola | 2014-07-14 19:52:05 +0200 |
---|---|---|
committer | Karel Zak | 2014-07-15 13:22:24 +0200 |
commit | 558445c93d4b7b2f4cc5bcb80ed13c83bebd02c1 (patch) | |
tree | 59a9916ab2f153daf6f03f8c9430eb442ac65acd /tests/helpers | |
parent | cfdisk: fix warning usage, improve 's' help (diff) | |
download | kernel-qcow2-util-linux-558445c93d4b7b2f4cc5bcb80ed13c83bebd02c1.tar.gz kernel-qcow2-util-linux-558445c93d4b7b2f4cc5bcb80ed13c83bebd02c1.tar.xz kernel-qcow2-util-linux-558445c93d4b7b2f4cc5bcb80ed13c83bebd02c1.zip |
tests: add kill --queue check
Correction. The final failure to catch signal exit should not use
exiter() function.
--->8----
From: Sami Kerola <kerolasa@iki.fi>
Date: Mon, 14 Jul 2014 18:35:56 +0100
Subject: [PATCH] tests: add kill --queue check
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'tests/helpers')
-rw-r--r-- | tests/helpers/test_sigreceive.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/tests/helpers/test_sigreceive.c b/tests/helpers/test_sigreceive.c index 3f76f0671..f1b954688 100644 --- a/tests/helpers/test_sigreceive.c +++ b/tests/helpers/test_sigreceive.c @@ -38,9 +38,16 @@ static void __attribute__((__noreturn__)) usage(FILE *out) } static __attribute__((__noreturn__)) -void exiter(int sig) +void exiter(int signo __attribute__((__unused__)), + siginfo_t *info, + void *context __attribute__((__unused__))) { - _exit(sig); + int ret = info->si_signo; + + if (info) + if (info->si_code == SI_QUEUE && info->si_value.sival_int != 0) + ret = info->si_value.sival_int; + _exit(ret); } int main(int argc, char **argv) @@ -81,8 +88,8 @@ int main(int argc, char **argv) } sigemptyset(&sigact.sa_mask); - sigact.sa_flags = 0; - sigact.sa_handler = exiter; + sigact.sa_flags = SA_SIGINFO; + sigact.sa_sigaction = exiter; timeout.tv_sec = 5; timeout.tv_usec = 0; @@ -171,5 +178,5 @@ int main(int argc, char **argv) FD_SET(STDIN_FILENO, &rfds); select(0, &rfds, NULL, NULL, &timeout); - exiter(TEST_SIGRECEIVE_FAILURE); + exit(TEST_SIGRECEIVE_FAILURE); } |