about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@gmail.com>2011-07-19 13:59:57 -0400
committerAndreas Schwab <schwab@redhat.com>2011-07-21 12:21:26 +0200
commitf6244abb8c68c705b8f8bfb3c8adb44dffe5a157 (patch)
tree7021e74269a3ad59f7868f9f2f2c6a0aa73835f2
parentb3c34b4a97273baf7546cd85bc90621571eee7cd (diff)
downloadglibc-f6244abb8c68c705b8f8bfb3c8adb44dffe5a157.tar.gz
glibc-f6244abb8c68c705b8f8bfb3c8adb44dffe5a157.tar.xz
glibc-f6244abb8c68c705b8f8bfb3c8adb44dffe5a157.zip
Avoid possible crashes in anormal nscd exits
(cherry picked from commit feb1eb0be78b40d53c71474f07d1b0517ba95586)
-rw-r--r--ChangeLog5
-rw-r--r--nscd/nscd.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 22f63b168c..d774296226 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-19  Ulrich Drepper  <drepper@gmail.com>
+
+	* nscd/nscd.c (termination_handler): Don't do anything for a database
+	if it has not yet been initialized.
+
 2011-07-05  Andreas Jaeger  <aj@suse.de>
 
 	[BZ#9696]
diff --git a/nscd/nscd.c b/nscd/nscd.c
index c3d9fe6cef..f50e81423f 100644
--- a/nscd/nscd.c
+++ b/nscd/nscd.c
@@ -477,7 +477,7 @@ termination_handler (int signum)
   /* Synchronize memory.  */
   for (int cnt = 0; cnt < lastdb; ++cnt)
     {
-      if (!dbs[cnt].enabled)
+      if (!dbs[cnt].enabled || dbs[cnt].head == NULL)
 	continue;
 
       /* Make sure nobody keeps using the database.  */