about summary refs log tree commit diff
path: root/nscd/connections.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-10 20:31:41 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-10 20:31:41 +0000
commitd13a3c579285d877984c5d9b7fa0ceb671b8a812 (patch)
treecc7ecf114f69d6e0b1dbbd39ecd753215f164f9e /nscd/connections.c
parentc0097ea1eb4684e12bc4f73fdd5384c4e9fcd9bd (diff)
downloadglibc-d13a3c579285d877984c5d9b7fa0ceb671b8a812.tar.gz
glibc-d13a3c579285d877984c5d9b7fa0ceb671b8a812.tar.xz
glibc-d13a3c579285d877984c5d9b7fa0ceb671b8a812.zip
Update.
2004-09-10  Ulrich Drepper  <drepper@redhat.com>

	* nscd/nscd_stat.c: Improve output by also printing .shared and
	.persistent.

	* nscd/connections.c: Allow cache sharing to be really disabled.
Diffstat (limited to 'nscd/connections.c')
-rw-r--r--nscd/connections.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/nscd/connections.c b/nscd/connections.c
index 2ca6f69cf2..11be7c3d0c 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -258,14 +258,16 @@ nscd_init (void)
 			       dbnames[cnt]);
 
 		    dbs[cnt].wr_fd = fd;
-		    dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY);
 		    fd = -1;
 		    /* We also need a read-only descriptor.  */
-		    dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY);
-		    if (dbs[cnt].ro_fd == -1)
-		      dbg_log (_("\
+		    if (dbs[cnt].shared)
+		      {
+			dbs[cnt].ro_fd = open (dbs[cnt].db_filename, O_RDONLY);
+			if (dbs[cnt].ro_fd == -1)
+			  dbg_log (_("\
 cannot create read-only descriptor for \"%s\"; no mmap"),
-			       dbs[cnt].db_filename);
+				   dbs[cnt].db_filename);
+		      }
 
 		    // XXX Shall we test whether the descriptors actually
 		    // XXX point to the same file?
@@ -299,7 +301,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
 		fd = open (dbs[cnt].db_filename,
 			   O_RDWR | O_CREAT | O_EXCL | O_TRUNC,
 			   S_IRUSR | S_IWUSR);
-		if (fd != -1)
+		if (fd != -1 && dbs[cnt].shared)
 		  ro_fd = open (dbs[cnt].db_filename, O_RDONLY);
 	      }
 	    else
@@ -312,7 +314,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
 
 		/* We do not need the file name anymore after we
 		   opened another file descriptor in read-only mode.  */
-		if (fd != -1)
+		if (fd != -1 && dbs[cnt].shared)
 		  {
 		    ro_fd = open (fname, O_RDONLY);
 
@@ -344,7 +346,7 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
 	      {
 		/* Tell the user if we could not create the read-only
 		   descriptor.  */
-		if (ro_fd == -1)
+		if (ro_fd == -1 && dbs[cnt].shared)
 		  dbg_log (_("\
 cannot create read-only descriptor for \"%s\"; no mmap"),
 			   dbs[cnt].db_filename);