about summary refs log tree commit diff
path: root/nscd/nscd_stat.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-13 17:24:41 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-13 17:24:41 +0000
commitaadd7d9d2645450f757ea99234192abb9aa7e244 (patch)
tree8a3cf55b948b80b58707cf864b7b97cbee2e66e2 /nscd/nscd_stat.c
parent407c4b9a19fc59dfea131c08b3075108ecfab8a3 (diff)
downloadglibc-aadd7d9d2645450f757ea99234192abb9aa7e244.tar.gz
glibc-aadd7d9d2645450f757ea99234192abb9aa7e244.tar.xz
glibc-aadd7d9d2645450f757ea99234192abb9aa7e244.zip
Update.
2004-09-13  Thorsten Kukuk  <kukuk@suse.de>

	* nscd/nscd_stat.c: Don't access dbs[cnt].head for disabled services.

	* nscd/nscd.init: Fix path to socket.
Diffstat (limited to 'nscd/nscd_stat.c')
-rw-r--r--nscd/nscd_stat.c30
1 files changed, 17 insertions, 13 deletions
diff --git a/nscd/nscd_stat.c b/nscd/nscd_stat.c
index 73dafe120b..ebdfeac1d4 100644
--- a/nscd/nscd_stat.c
+++ b/nscd/nscd_stat.c
@@ -88,25 +88,29 @@ send_stats (int fd, struct database_dyn dbs[lastdb])
 
   for (cnt = 0; cnt < lastdb; ++cnt)
     {
+      memset (&data.dbs[cnt], 0, sizeof (data.dbs[cnt]));
       data.dbs[cnt].enabled = dbs[cnt].enabled;
       data.dbs[cnt].check_file = dbs[cnt].check_file;
       data.dbs[cnt].shared = dbs[cnt].shared;
       data.dbs[cnt].persistent = dbs[cnt].persistent;
-      data.dbs[cnt].module = dbs[cnt].head->module;
       data.dbs[cnt].postimeout = dbs[cnt].postimeout;
       data.dbs[cnt].negtimeout = dbs[cnt].negtimeout;
-      data.dbs[cnt].poshit = dbs[cnt].head->poshit;
-      data.dbs[cnt].neghit = dbs[cnt].head->neghit;
-      data.dbs[cnt].posmiss = dbs[cnt].head->posmiss;
-      data.dbs[cnt].negmiss = dbs[cnt].head->negmiss;
-      data.dbs[cnt].nentries = dbs[cnt].head->nentries;
-      data.dbs[cnt].maxnentries = dbs[cnt].head->maxnentries;
-      data.dbs[cnt].datasize = dbs[cnt].head->data_size;
-      data.dbs[cnt].dataused = dbs[cnt].head->first_free;
-      data.dbs[cnt].maxnsearched = dbs[cnt].head->maxnsearched;
-      data.dbs[cnt].rdlockdelayed = dbs[cnt].head->rdlockdelayed;
-      data.dbs[cnt].wrlockdelayed = dbs[cnt].head->wrlockdelayed;
-      data.dbs[cnt].addfailed = dbs[cnt].head->addfailed;
+      if (dbs[cnt].head != NULL)
+	{
+	  data.dbs[cnt].module = dbs[cnt].head->module;
+	  data.dbs[cnt].poshit = dbs[cnt].head->poshit;
+	  data.dbs[cnt].neghit = dbs[cnt].head->neghit;
+	  data.dbs[cnt].posmiss = dbs[cnt].head->posmiss;
+	  data.dbs[cnt].negmiss = dbs[cnt].head->negmiss;
+	  data.dbs[cnt].nentries = dbs[cnt].head->nentries;
+	  data.dbs[cnt].maxnentries = dbs[cnt].head->maxnentries;
+	  data.dbs[cnt].datasize = dbs[cnt].head->data_size;
+	  data.dbs[cnt].dataused = dbs[cnt].head->first_free;
+	  data.dbs[cnt].maxnsearched = dbs[cnt].head->maxnsearched;
+	  data.dbs[cnt].rdlockdelayed = dbs[cnt].head->rdlockdelayed;
+	  data.dbs[cnt].wrlockdelayed = dbs[cnt].head->wrlockdelayed;
+	  data.dbs[cnt].addfailed = dbs[cnt].head->addfailed;
+	}
     }
 
   if (TEMP_FAILURE_RETRY (write (fd, &data, sizeof (data))) != sizeof (data))