From: Willy Tarreau Date: Wed, 20 Apr 2016 08:20:22 +0000 (+0200) Subject: TESTS: add blocksig.c to run tests with all signals blocked X-Git-Tag: v1.7-dev3~31 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=07ecdea16562ddebe5ad1e8adaa2710ef7a82bb6;p=thirdparty%2Fhaproxy.git 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. --- diff --git a/tests/blocksig.c b/tests/blocksig.c new file mode 100644 index 0000000000..13b55e7fce --- /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; +}