]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: external-checks: do not unblock undesired signals
authorWilly Tarreau <w@1wt.eu>
Tue, 21 Jun 2016 15:29:46 +0000 (17:29 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 21 Jun 2016 16:10:50 +0000 (18:10 +0200)
The external checks code makes use of block_sigchld() and unblock_sigchld()
to ensure nobody modifies the signals list while they're being manipulated.
It happens that these functions clear the list of blocked signals, so they
can possibly have a side effect if other signals are blocked. For now no
other signal is blocked but it may very well change in the future so rather
correctly use SIG_BLOCK/SIG_UNBLOCK instead of touching unrelated signals.

This fix should be backported to 1.6 for correctness.

src/checks.c

index ee0295edf32995d19bfbb44c9f0cafdb7d996a46..b925d05613050db0081f25dd87482132d4a7313d 100644 (file)
@@ -1541,14 +1541,15 @@ void block_sigchld(void)
        sigset_t set;
        sigemptyset(&set);
        sigaddset(&set, SIGCHLD);
-       assert(sigprocmask(SIG_SETMASK, &set, NULL) == 0);
+       assert(sigprocmask(SIG_BLOCK, &set, NULL) == 0);
 }
 
 void unblock_sigchld(void)
 {
        sigset_t set;
        sigemptyset(&set);
-       assert(sigprocmask(SIG_SETMASK, &set, NULL) == 0);
+       sigaddset(&set, SIGCHLD);
+       assert(sigprocmask(SIG_UNBLOCK, &set, NULL) == 0);
 }
 
 /* Call with SIGCHLD blocked */