From 07ecdea16562ddebe5ad1e8adaa2710ef7a82bb6 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 20 Apr 2016 10:20:22 +0200 Subject: [PATCH] TESTS: add blocksig.c to run tests with all signals blocked A problem was reported recently by some users of programs compiled with Go 1.5 which by default blocks all signals before executing processes, resulting in haproxy not receiving SIGUSR1 or even SIGTERM. This program mimmicks this behaviour to make it easier to run tests. It also displays the current signal mask. A simple test consists in running it through itself. --- tests/blocksig.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 tests/blocksig.c diff --git a/tests/blocksig.c b/tests/blocksig.c new file mode 100644 index 000000000..13b55e7fc --- /dev/null +++ b/tests/blocksig.c @@ -0,0 +1,16 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + sigset_t new_sig, old_sig; + + sigfillset(&new_sig); + sigprocmask(SIG_SETMASK, &new_sig, &old_sig); + printf("old_sig: %16Lx\n", *(unsigned long long*)&old_sig); + printf("new_sig: %16Lx\n", *(unsigned long long*)&new_sig); + + argc--; argv++; + return argc ? execvp(*argv, argv) : 0; +}