summary refs log tree commit diff
path: root/nscd
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2004-10-18 09:58:59 +0000
committerJakub Jelinek <jakub@redhat.com>2004-10-18 09:58:59 +0000
commit56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1 (patch)
treef2d0f6e1aaf9794668b53c6456fcacbbacd63805 /nscd
parent4ce1a5c9712b4d7616058e708630c33744f983f6 (diff)
downloadglibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.tar.gz
glibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.tar.xz
glibc-56c4396a6e1568a5511ac43873fa3c9e1ebfa8d1.zip
Updated to fedora-glibc-20041018T0940
Diffstat (limited to 'nscd')
-rw-r--r--nscd/Makefile4
-rw-r--r--nscd/connections.c10
-rw-r--r--nscd/nscd.h9
-rw-r--r--nscd/nscd.init1
4 files changed, 13 insertions, 11 deletions
diff --git a/nscd/Makefile b/nscd/Makefile
index 70a35198c2..b21edc2b79 100644
--- a/nscd/Makefile
+++ b/nscd/Makefile
@@ -123,10 +123,10 @@ $(objpfx)nscd_nischeck: $(objpfx)nscd_nischeck.o
 
 ifeq ($(build-shared),yes)
 $(objpfx)nscd: $(common-objpfx)rt/librt.so $(shared-thread-library) \
-	       $(common-objpfx)nis/libnsl.so
+	       $(common-objpfx)nis/libnsl.so $(selinux-LIBS)
 $(objpfx)nscd_nischeck: $(common-objpfx)nis/libnsl.so
 else
 $(objpfx)nscd: $(common-objpfx)rt/librt.a $(static-thread-library) \
-	       $(common-objpfx)nis/libnsl.a
+	       $(common-objpfx)nis/libnsl.a $(selinux-LIBS)
 $(objpfx)nscd_nischeck: $(common-objpfx)nis/libnsl.a
 endif
diff --git a/nscd/connections.c b/nscd/connections.c
index d9c11f5425..aa760e0252 100644
--- a/nscd/connections.c
+++ b/nscd/connections.c
@@ -321,17 +321,15 @@ cannot create read-only descriptor for \"%s\"; no mmap"),
 	      }
 	    else
 	      {
-		size_t slen = strlen (dbs[cnt].db_filename);
-		char fname[slen + 8];
-		strcpy (mempcpy (fname, dbs[cnt].db_filename, slen),
-			".XXXXXX");
+		char fname[] = _PATH_NSCD_XYZ_DB_TMP;
 		fd = mkstemp (fname);
 
 		/* We do not need the file name anymore after we
 		   opened another file descriptor in read-only mode.  */
-		if (fd != -1 && dbs[cnt].shared)
+		if (fd != -1)
 		  {
-		    ro_fd = open (fname, O_RDONLY);
+		    if (dbs[cnt].shared)
+		      ro_fd = open (fname, O_RDONLY);
 
 		    unlink (fname);
 		  }
diff --git a/nscd/nscd.h b/nscd/nscd.h
index 4e00f69fb9..d5dc613d22 100644
--- a/nscd/nscd.h
+++ b/nscd/nscd.h
@@ -87,9 +87,12 @@ struct database_dyn
 
 
 /* Paths of the file for the persistent storage.  */
-#define _PATH_NSCD_PASSWD_DB	"/var/run/nscd/passwd"
-#define _PATH_NSCD_GROUP_DB	"/var/run/nscd/group"
-#define _PATH_NSCD_HOSTS_DB	"/var/run/nscd/hosts"
+#define _PATH_NSCD_PASSWD_DB	"/var/db/nscd/passwd"
+#define _PATH_NSCD_GROUP_DB	"/var/db/nscd/group"
+#define _PATH_NSCD_HOSTS_DB	"/var/db/nscd/hosts"
+
+/* Path used when not using persistent storage.  */
+#define _PATH_NSCD_XYZ_DB_TMP	"/var/run/nscd/dbXXXXXX"
 
 
 /* Global variables.  */
diff --git a/nscd/nscd.init b/nscd/nscd.init
index 568fe3e1e2..d5c1cb9ae3 100644
--- a/nscd/nscd.init
+++ b/nscd/nscd.init
@@ -38,6 +38,7 @@ prog=nscd
 
 start () {
     [ -d /var/run/nscd ] || mkdir /var/run/nscd
+    [ -d /var/db/nscd ] || mkdir /var/db/nscd
     secure=""
 #   for table in passwd group hosts
 #   do