From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jacek Konieczny Date: Fri, 2 Nov 2012 16:39:50 +0100 Subject: [Cluster-devel] [PATCH 3/3] Do not crash uncleanly on SIGINT and SIGHUP In-Reply-To: <1351870790-22294-1-git-send-email-jajcus@jajcus.net> References: <1351870790-22294-1-git-send-email-jajcus@jajcus.net> Message-ID: <1351870790-22294-4-git-send-email-jajcus@jajcus.net> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Unclean shut-down of dlm_controld may trigger a node fencing, this should not be triggered by mistake. SIGINT is the natural way to stop dlm_controld started on a terminal with '-D' for debugging ? let this work like SIGTERM. SIGHUP is often used for config reload. dlm_controld doesn't support that, but when someone tries this by mistake, this is not a reason to crash. Signed-off-by: Jacek Konieczny --- dlm_controld/main.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/dlm_controld/main.c b/dlm_controld/main.c index 6eafa49..fd469f9 100644 --- a/dlm_controld/main.c +++ b/dlm_controld/main.c @@ -1582,6 +1582,15 @@ int main(int argc, char **argv) rv = sigaction(SIGTERM, &act, NULL); if (rv < 0) return -rv; + rv = sigaction(SIGINT, &act, NULL); + if (rv < 0) + return -rv; + + memset(&act, 0, sizeof(act)); + act.sa_handler = SIG_IGN; + rv = sigaction(SIGHUP, &act, NULL); + if (rv < 0) + return -rv; memset(&act, 0, sizeof(act)); act.sa_handler = sigchld_handler; -- 1.7.12.4