[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

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



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 <jajcus jajcus net>
---
 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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]