[PATCH] nscd: don't crash if killed early

Andreas Schwab schwab@redhat.com
Tue Jul 19 12:35:00 GMT 2011


2011-07-19  Andreas Schwab  <schwab@redhat.com>

	* nscd/nscd.c (main): Don't install termination_handler until
	after databases are initialized.
---
 nscd/nscd.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/nscd/nscd.c b/nscd/nscd.c
index 4894cb2..3522f6b 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -267,9 +267,6 @@ main (int argc, char **argv)
   if (selinux_enabled)
     nscd_avc_init ();
 
-  signal (SIGINT, termination_handler);
-  signal (SIGQUIT, termination_handler);
-  signal (SIGTERM, termination_handler);
   signal (SIGPIPE, SIG_IGN);
 
   /* Cleanup files created by a previous 'bind'.  */
@@ -294,6 +291,10 @@ main (int argc, char **argv)
   /* Init databases.  */
   nscd_init ();
 
+  signal (SIGINT, termination_handler);
+  signal (SIGQUIT, termination_handler);
+  signal (SIGTERM, termination_handler);
+
   /* Handle incoming requests */
   start_threads ();
 
-- 
1.7.6


-- 
Andreas Schwab, schwab@redhat.com
GPG Key fingerprint = D4E8 DBE3 3813 BB5D FA84  5EC7 45C6 250E 6F00 984E
"And now for something completely different."



More information about the Libc-hacker mailing list