diff options
Diffstat (limited to 'ctdb')
-rw-r--r-- | ctdb/server/ctdb_cluster_mutex.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c index e8c75debfb8..330d5fd1d90 100644 --- a/ctdb/server/ctdb_cluster_mutex.c +++ b/ctdb/server/ctdb_cluster_mutex.c @@ -196,6 +196,7 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx, { struct ctdb_cluster_mutex_handle *h; char **args; + sigset_t sigset_term; int ret; h = talloc(mem_ctx, struct ctdb_cluster_mutex_handle); @@ -225,11 +226,22 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx, return NULL; } + sigemptyset(&sigset_term); + sigaddset(&sigset_term, SIGTERM); + ret = sigprocmask(SIG_BLOCK, &sigset_term, NULL); + if (ret != 0) { + DBG_WARNING("Failed to block SIGTERM (%d)\n", errno); + } + h->child = ctdb_fork(ctdb); if (h->child == (pid_t)-1) { close(h->fd[0]); close(h->fd[1]); talloc_free(h); + ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL); + if (ret != 0) { + DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno); + } return NULL; } @@ -244,6 +256,11 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx, errno); } + ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL); + if (ret != 0) { + DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno); + } + /* Make stdout point to the pipe */ close(STDOUT_FILENO); dup2(h->fd[1], STDOUT_FILENO); @@ -258,6 +275,11 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx, /* Parent */ + ret = sigprocmask(SIG_UNBLOCK, &sigset_term, NULL); + if (ret != 0) { + DBG_WARNING("Failed to unblock SIGTERM (%d)\n", errno); + } + DEBUG(DEBUG_DEBUG, (__location__ " Created PIPE FD:%d\n", h->fd[0])); set_close_on_exec(h->fd[0]); |