summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@redhat.com>2009-10-30 16:11:14 +0100
committerAndreas Schwab <schwab@redhat.com>2009-10-30 16:11:14 +0100
commit017dd87448e913383a8be5773569f218e8c661c5 (patch)
treed9124fdbb290416e60553c87aa9f9f1750d7acb8 /nscd
parentf8e81cec78280ef92014305c1e10a808b1260683 (diff)
parent3a83202db6e5591f2b72974c1ad98602c6620770 (diff)
downloadglibc-017dd87448e913383a8be5773569f218e8c661c5.tar.gz
glibc-017dd87448e913383a8be5773569f218e8c661c5.tar.xz
glibc-017dd87448e913383a8be5773569f218e8c661c5.zip
Merge remote branch 'origin/master' into fedora/master
Diffstat (limited to 'nscd')
-rw-r--r--nscd/aicache.c6
-rw-r--r--nscd/dbg_log.c17
-rw-r--r--nscd/grpcache.c6
-rw-r--r--nscd/hstcache.c2
-rw-r--r--nscd/initgrcache.c6
-rw-r--r--nscd/pwdcache.c6
6 files changed, 26 insertions, 17 deletions
diff --git a/nscd/aicache.c b/nscd/aicache.c
index 524c0a63af..992357d2fe 100644
--- a/nscd/aicache.c
+++ b/nscd/aicache.c
@@ -453,13 +453,13 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head + total
+	      assert ((char *) dataset - (char *) db->head + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      ssize_t written;
 	      written = sendfileall (fd, db->wr_fd, (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -470,7 +470,7 @@ addhstaiX (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    writeall (fd, &dataset->resp, total);
+	    writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
       goto out;
diff --git a/nscd/dbg_log.c b/nscd/dbg_log.c
index 5e192c97dd..fa99dac88f 100644
--- a/nscd/dbg_log.c
+++ b/nscd/dbg_log.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 1998, 2000, 2004, 2005 Free Software Foundation, Inc.
+/* Copyright (c) 1998, 2000, 2004, 2005, 2009 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
 
@@ -53,14 +53,23 @@ void
 dbg_log (const char *fmt,...)
 {
   va_list ap;
-  char msg[512], msg2[512];
+  char msg2[512];
 
   va_start (ap, fmt);
-  vsnprintf (msg2, sizeof (msg), fmt, ap);
+  vsnprintf (msg2, sizeof (msg2), fmt, ap);
 
   if (debug_level > 0)
     {
-      snprintf (msg, sizeof (msg), "%d: %s%s", getpid (), msg2,
+      time_t t = time (NULL);
+
+      struct tm now;
+      localtime_r (&t, &now);
+
+      char buf[256];
+      strftime (buf, sizeof (buf), "%c", &now);
+
+      char msg[512];
+      snprintf (msg, sizeof (msg), "%s - %d: %s%s", buf, getpid (), msg2,
 		msg2[strlen (msg2) - 1] == '\n' ? "" : "\n");
       if (dbgout)
 	{
diff --git a/nscd/grpcache.c b/nscd/grpcache.c
index 184d53898c..bd101c675d 100644
--- a/nscd/grpcache.c
+++ b/nscd/grpcache.c
@@ -295,14 +295,14 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -313,7 +313,7 @@ cache_addgr (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
       /* Add the record to the database.  But only if it has not been
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 51e2273960..228f6fd8ab 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -337,7 +337,7 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
diff --git a/nscd/initgrcache.c b/nscd/initgrcache.c
index c33aaf315f..8195b6609e 100644
--- a/nscd/initgrcache.c
+++ b/nscd/initgrcache.c
@@ -350,14 +350,14 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
 			  + db->head->module * sizeof (ref_t)
 			  + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize);
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -368,7 +368,7 @@ addinitgroupsX (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}
 
 
diff --git a/nscd/pwdcache.c b/nscd/pwdcache.c
index 2338e7e1e0..75f2221e88 100644
--- a/nscd/pwdcache.c
+++ b/nscd/pwdcache.c
@@ -290,14 +290,14 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
 	    {
 	      assert (db->wr_fd != -1);
 	      assert ((char *) &dataset->resp > (char *) db->data);
-	      assert ((char *) &dataset->resp - (char *) db->head
+	      assert ((char *) dataset - (char *) db->head
 		      + total
 		      <= (sizeof (struct database_pers_head)
                           + db->head->module * sizeof (ref_t)
                           + db->head->data_size));
 	      written = sendfileall (fd, db->wr_fd,
 				     (char *) &dataset->resp
-				     - (char *) db->head, total);
+				     - (char *) db->head, dataset->head.recsize );
 # ifndef __ASSUME_SENDFILE
 	      if (written == -1 && errno == ENOSYS)
 		goto use_write;
@@ -308,7 +308,7 @@ cache_addpw (struct database_dyn *db, int fd, request_header *req,
 	  use_write:
 # endif
 #endif
-	    written = writeall (fd, &dataset->resp, total);
+	    written = writeall (fd, &dataset->resp, dataset->head.recsize);
 	}