about summary refs log tree commit diff
path: root/nss/nsswitch.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1996-08-12 03:00:59 +0000
committerUlrich Drepper <drepper@redhat.com>1996-08-12 03:00:59 +0000
commit15a83d04bba6b93b3c72d351b7a405e8b5651bd8 (patch)
tree26a91e0ae76ed3f7a6b76dff0a783f8e6ade6e3b /nss/nsswitch.c
parenta8874eadae699b5d4583aab3a860e06ecfcf5e5a (diff)
downloadglibc-15a83d04bba6b93b3c72d351b7a405e8b5651bd8.tar.gz
glibc-15a83d04bba6b93b3c72d351b7a405e8b5651bd8.tar.xz
glibc-15a83d04bba6b93b3c72d351b7a405e8b5651bd8.zip
Few last minute patches from main on 960811 cvs/libc-960812
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 0a4c9482d2..69b1be5e08 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -83,7 +83,10 @@ __nss_database_lookup (const char *database, const char *defconfig,
   /* Reconsider database variable in case some other thread called
      `__nss_configure_lookup' while we waited for the lock.  */
   if (*ni != NULL)
-    return 0;
+    {
+      __libc_lock_unlock (lock);
+      return 0;
+    }
 
   if (nss_initialized == 0 && service_table == NULL)
     /* Read config file.  */
@@ -99,10 +102,7 @@ __nss_database_lookup (const char *database, const char *defconfig,
 	 only requested once and so this might not be critical.  */
       for (entry = service_table->entry; entry != NULL; entry = entry->next)
 	if (strcmp (database, entry->name) == 0)
-	  {
-	    *ni = entry->service;
-	    return 0;
-	  }
+	  *ni = entry->service;
     }
 
   /* No configuration data is available, either because nsswitch.conf
@@ -110,7 +110,9 @@ __nss_database_lookup (const char *database, const char *defconfig,
 
      DEFCONFIG specifies the default service list for this database,
      or null to use the most common default.  */
-  *ni = nss_parse_service_list (defconfig ?: "compat [NOTFOUND=return] files");
+  if (*ni == NULL)
+    *ni = nss_parse_service_list (defconfig
+				  ?: "compat [NOTFOUND=return] files");
 
   __libc_lock_unlock (lock);