summary refs log tree commit diff
path: root/nscd/hstcache.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-10 23:56:29 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-10 23:56:29 +0000
commit3418007ed675c2ab8a9885bcd101752246f9c2d8 (patch)
tree1a0d2e7f986886c77389bf78250eff720810c6cc /nscd/hstcache.c
parent9b2dc5158996348484428ef6698186628152da3f (diff)
downloadglibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.tar.gz
glibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.tar.xz
glibc-3418007ed675c2ab8a9885bcd101752246f9c2d8.zip
Update.
2004-09-10  Ulrich Drepper  <drepper@redhat.com>

	* nscd/nscd.c (pagesize_m1): New variable.
	(main): Initialize it.
	* nscd/nscd.h: Declare pagesize_m1.
	* nscd/hstcache.c: Pass correctly aligned address to msync.
	* nscd/grpcache.c: Likewise.
	* nscd/pwdcache.c: Likewise.
Diffstat (limited to 'nscd/hstcache.c')
-rw-r--r--nscd/hstcache.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/nscd/hstcache.c b/nscd/hstcache.c
index 94568d0d2b..78e29fb3d1 100644
--- a/nscd/hstcache.c
+++ b/nscd/hstcache.c
@@ -332,8 +332,13 @@ cache_addhst (struct database_dyn *db, int fd, request_header *req,
 	{
 	  /* If necessary, we also propagate the data to disk.  */
 	  if (db->persistent)
-	    // XXX async OK?
-	    msync (dataset, total + req->key_len, MS_ASYNC);
+	    {
+	      // XXX async OK?
+	      uintptr_t pval = (uintptr_t) dataset & ~pagesize_m1;
+	      msync ((void *) pval,
+		     ((uintptr_t) dataset & pagesize_m1)
+		     + total + req->key_len, MS_ASYNC);
+	    }
 
 	  addr_list_type = (hst->h_length == NS_INADDRSZ
 			    ? GETHOSTBYADDR : GETHOSTBYADDRv6);