summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/secondary.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2010-09-22 19:08:11 +0000
committerpjd <pjd@FreeBSD.org>2010-09-22 19:08:11 +0000
commit67279d16ee319cb5904e06282acb094216407755 (patch)
treebacc321cf8b67b3b710a5e41960ab926cee818ab /sbin/hastd/secondary.c
parent2eee4ca70d37cd47c54a9641d8bd574f33579200 (diff)
downloadFreeBSD-src-67279d16ee319cb5904e06282acb094216407755.zip
FreeBSD-src-67279d16ee319cb5904e06282acb094216407755.tar.gz
Switch to sigprocmask(2) API also in the main process and secondary process.
This way the primary process inherits signal mask from the main process, which fixes a race where signal is delivered to the primary process before configuring signal mask. Reported by: Mikolaj Golub <to.my.trociny@gmail.com> MFC after: 3 days
Diffstat (limited to 'sbin/hastd/secondary.c')
-rw-r--r--sbin/hastd/secondary.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sbin/hastd/secondary.c b/sbin/hastd/secondary.c
index 9e1e537..403c5b2 100644
--- a/sbin/hastd/secondary.c
+++ b/sbin/hastd/secondary.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
#include <fcntl.h>
#include <libgeom.h>
#include <pthread.h>
+#include <signal.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
@@ -334,6 +335,7 @@ init_remote(struct hast_resource *res, struct nv *nvin)
void
hastd_secondary(struct hast_resource *res, struct nv *nvin)
{
+ sigset_t mask;
pthread_t td;
pid_t pid;
int error;
@@ -380,8 +382,8 @@ hastd_secondary(struct hast_resource *res, struct nv *nvin)
setproctitle("%s (secondary)", res->hr_name);
- signal(SIGHUP, SIG_DFL);
- signal(SIGCHLD, SIG_DFL);
+ PJDLOG_VERIFY(sigemptyset(&mask) == 0);
+ PJDLOG_VERIFY(sigprocmask(SIG_SETMASK, &mask, NULL) == 0);
/* Declare that we are sender. */
proto_send(res->hr_event, NULL, 0);
OpenPOWER on IntegriCloud