diff freeDiameterd/main.c @ 683:d59effdf5256

Improve management of the signals in freeDiameterd
author Sebastien Decugis <sdecugis@nict.go.jp>
date Tue, 18 Jan 2011 15:13:14 +0900
parents 2e94ef0515d7
children 4a9f08d6b6ba
line wrap: on
line diff
--- a/freeDiameterd/main.c	Tue Jan 18 14:56:01 2011 +0900
+++ b/freeDiameterd/main.c	Tue Jan 18 15:13:14 2011 +0900
@@ -61,7 +61,7 @@
 	int ret;
 	sigset_t sig_all;
 	
-	/* Block all signals from the current thread and all its future children */
+	/* Block all signals from the current thread and all its future children -- we will catch everything in catch_signals */
 	sigfillset(&sig_all);
 	ret = pthread_sigmask(SIG_BLOCK, &sig_all, NULL);
 	ASSERT(ret == 0);
@@ -269,6 +269,9 @@
 	sigaddset(&ss, SIGUSR1);
 	sigaddset(&ss, SIGUSR2);
 	
+	/* We unblock all other signals, so that their default handler is used (such as SIGTSTP) */
+	CHECK_SYS_DO( pthread_sigmask( SIG_SETMASK, &ss, NULL ), goto out );
+	
 	/* Now loop on the reception of the signal */
 	while (1) {
 		int sig, *ps;
"Welcome to our mercurial repository"