about summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
Diffstat (limited to 'nscd')
-rw-r--r--nscd/nscd.init2
-rw-r--r--nscd/nscd_helper.c4
-rw-r--r--nscd/nscd_stat.c30
3 files changed, 20 insertions, 16 deletions
diff --git a/nscd/nscd.init b/nscd/nscd.init
index 3796b3d0a0..568fe3e1e2 100644
--- a/nscd/nscd.init
+++ b/nscd/nscd.init
@@ -62,7 +62,7 @@ stop () {
 	# nscd won't be able to remove these if it is running as
 	# a non-privileged user
 	rm -f /var/run/nscd/nscd.pid
-	rm -f /var/run/nscd/.socket
+	rm -f /var/run/nscd/socket
        	success $"$prog shutdown"
     else
        	failure $"$prog shutdown"
diff --git a/nscd/nscd_helper.c b/nscd/nscd_helper.c
index ff27b0797e..e40500c83c 100644
--- a/nscd/nscd_helper.c
+++ b/nscd/nscd_helper.c
@@ -141,11 +141,11 @@ get_mapping (request_type type, const char *key,
   if (TEMP_FAILURE_RETRY (__recvmsg (sock, &msg, 0)) != keylen)
     goto out_close2;
 
+  mapfd = *(int *) CMSG_DATA (cmsg);
+
   if (CMSG_FIRSTHDR (&msg)->cmsg_len != CMSG_LEN (sizeof (int)))
     goto out_close;
 
-  mapfd = *(int *) CMSG_DATA (cmsg);
-
   struct stat64 st;
   if (strcmp (resdata, key) != 0
       || fstat64 (mapfd, &st) != 0
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))