[Cluster-devel] [PATCH 3/3] Do not crash uncleanly on SIGINT and SIGHUP

Jacek Konieczny <[email protected]>
Newsgroups com.redhat.cluster-devel
Message-ID <[email protected]>
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 <[email protected]>
---
 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.