about summary refs log tree commit diff
path: root/nss/nsswitch.c
diff options
context:
space:
mode:
Diffstat (limited to 'nss/nsswitch.c')
-rw-r--r--nss/nsswitch.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/nss/nsswitch.c b/nss/nsswitch.c
index 65da26b185..2a3e44a37d 100644
--- a/nss/nsswitch.c
+++ b/nss/nsswitch.c
@@ -69,6 +69,9 @@ static struct
 __libc_lock_define_initialized (static, lock)
 
 
+/* Nonzero if no NSCD is available.  */
+int __nss_nscd_not_available;
+
 #if !defined DO_STATIC_NSS || defined PIC
 /* String with revision number of the shared object files.  */
 static const char *const __nss_shlib_revision = LIBNSS_FILES_SO + 15;
@@ -380,7 +383,7 @@ nss_lookup_function (service_user *ni, const char *fct_name)
 	      /* Load the shared library.  */
 	      size_t shlen = (7 + strlen (ni->library->name) + 3
 			      + strlen (__nss_shlib_revision) + 1);
-
+	      int saved_errno = errno;
 	      struct do_open_args args;
 	      args.shlib_name = __alloca (shlen);
 	      args.ni = ni;
@@ -393,8 +396,11 @@ nss_lookup_function (service_user *ni, const char *fct_name)
 			__nss_shlib_revision);
 
 	      if (nss_dlerror_run (do_open, &args) != 0)
-		/* Failed to load the library.  */
-		ni->library->lib_handle = (void *) -1l;
+		{
+		  /* Failed to load the library.  */
+		  ni->library->lib_handle = (void *) -1l;
+		  __set_errno (saved_errno);
+		}
 	    }
 
 	  if (ni->library->lib_handle == (void *) -1l)