notifyd: Move BlockSignals calls to server.c
authorVolker Lendecke <vl@samba.org>
Tue, 19 Jul 2016 12:36:07 +0000 (14:36 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 20 Jul 2016 07:03:59 +0000 (09:03 +0200)
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@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jul 20 09:04:00 CEST 2016 on sn-devel-144

source3/smbd/notifyd/notifyd.c
source3/smbd/server.c

index 519109f934cc20ce1df2bd230e5ca89affc9dde3..69d30f79cf0ad9d4c9a9fddcc733dbb40c72df95 100644 (file)
@@ -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
index 0d7e43b0811029d899737332d41adbde42f325f4..9e3c652e16ec2b2bbfb5837b377e7209379930c9 100644 (file)
@@ -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);