[PATCH] notifyd: Move BlockSignals calls to server.c

Volker Lendecke vl at samba.org
Tue Jul 19 12:40:23 UTC 2016


Hi!

Review appreciated!

Thanks, Volker
-------------- next part --------------
>From cf32eceb878b021b1e2c0baaaef271e0f0e6e9c8 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl at samba.org>
Date: Tue, 19 Jul 2016 14:36:07 +0200
Subject: [PATCH] notifyd: Move BlockSignals calls to server.c

notifyd_send() is called as part of smbd initialization both in normal daemon
mode after a fork, but also in interactive mode. In interactive mode, notifyd
should not modify the global signal state with BlockSignals(). This patch moves
the signal blocking to the place where we know that notifyd is a child daemon.

Signed-off-by: Volker Lendecke <vl at samba.org>
---
 source3/smbd/notifyd/notifyd.c | 4 ----
 source3/smbd/server.c          | 4 ++++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/source3/smbd/notifyd/notifyd.c b/source3/smbd/notifyd/notifyd.c
index a78f5cd..099954f 100644
--- a/source3/smbd/notifyd/notifyd.c
+++ b/source3/smbd/notifyd/notifyd.c
@@ -258,10 +258,6 @@ struct tevent_req *notifyd_send(TALLOC_CTX *mem_ctx, struct tevent_context *ev,
 		return tevent_req_post(req, ev);
 	}
 
-	/* Block those signals that we are not handling */
-	BlockSignals(True, SIGHUP);
-	BlockSignals(True, SIGUSR1);
-
 	if (ctdbd_conn == NULL) {
 		/*
 		 * No cluster around, skip the database replication
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 030ae1c..b639b55c 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -416,6 +416,10 @@ static bool smbd_notifyd_init(struct messaging_context *msg, bool interactive,
 	}
 	tevent_req_set_callback(req, notifyd_stopped, msg);
 
+	/* Block those signals that we are not handling */
+	BlockSignals(True, SIGHUP);
+	BlockSignals(True, SIGUSR1);
+
 	messaging_send(msg, pid_to_procid(getppid()), MSG_SMB_NOTIFY_STARTED,
 		       NULL);
 
-- 
2.1.4



More information about the samba-technical mailing list