summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorMartin Schwenke <martin@meltin.net>2018-09-12 14:18:00 +1000
committerKarolin Seeger <kseeger@samba.org>2018-09-20 09:13:11 +0200
commit1954a94203789422b163b4f257aa3c9ab83fa9a2 (patch)
tree0421a61862c7f57279447692f081aa5eb30b9777 /ctdb
parentb29d90ffa4408b416a76550f9ab617b6e5303313 (diff)
downloadsamba-1954a94203789422b163b4f257aa3c9ab83fa9a2.tar.gz
ctdb-cluster-mutex: Reset SIGTERM handler in cluster mutex child
If SIGTERM is received and the tevent signal handler setup in the recovery daemon is still enabled then the signal is handled and a corresponding event is queued. The child never runs an event loop so the signal is effectively ignored. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13617 Signed-off-by: Martin Schwenke <martin@meltin.net> Reviewed-by: Amitay Isaacs <amitay@gmail.com> (cherry picked from commit 5a6b139884f08ee2ee10f9d16fe56ad8fb5352a6)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/server/ctdb_cluster_mutex.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ctdb/server/ctdb_cluster_mutex.c b/ctdb/server/ctdb_cluster_mutex.c
index 804c6d5dd8c..e8c75debfb8 100644
--- a/ctdb/server/ctdb_cluster_mutex.c
+++ b/ctdb/server/ctdb_cluster_mutex.c
@@ -234,6 +234,16 @@ ctdb_cluster_mutex(TALLOC_CTX *mem_ctx,
}
if (h->child == 0) {
+ struct sigaction sa = {
+ .sa_handler = SIG_DFL,
+ };
+
+ ret = sigaction(SIGTERM, &sa, NULL);
+ if (ret != 0) {
+ DBG_WARNING("Failed to reset signal handler (%d)\n",
+ errno);
+ }
+
/* Make stdout point to the pipe */
close(STDOUT_FILENO);
dup2(h->fd[1], STDOUT_FILENO);