From 558445c93d4b7b2f4cc5bcb80ed13c83bebd02c1 Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Mon, 14 Jul 2014 18:52:05 +0100 Subject: tests: add kill --queue check Correction. The final failure to catch signal exit should not use exiter() function. --->8---- From: Sami Kerola Date: Mon, 14 Jul 2014 18:35:56 +0100 Subject: [PATCH] tests: add kill --queue check Signed-off-by: Sami Kerola --- tests/helpers/test_sigreceive.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'tests/helpers') 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); } -- cgit v1.2.3-55-g7522