Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > 11f97bbd2adce813d2e3f0d63eb2159f > files > 50

glibc-2.20-22.mga5.src.rpm

diff -Nurp glibc-2.17/nss/nsswitch.c glibc-2.17.nss/nss/nsswitch.c
--- glibc-2.17/nss/nsswitch.c	2012-12-25 05:02:13.000000000 +0200
+++ glibc-2.17.nss/nss/nsswitch.c	2012-12-28 23:23:44.794018997 +0200
@@ -358,9 +358,21 @@ nss_load_library (service_user *ni)
       ni->library->lib_handle = __libc_dlopen (shlib_name);
       if (ni->library->lib_handle == NULL)
 	{
-	  /* Failed to load the library.  */
-	  ni->library->lib_handle = (void *) -1l;
-	  __set_errno (saved_errno);
+	  /* Failed to load the library. Try a fallback. */
+	  int n = __snprintf(shlib_name, shlen, "libnss_%s.so.%d.%d",
+			    ni->library->name, __GLIBC__, __GLIBC_MINOR__);
+
+	  if (n >= shlen)
+	    ni->library->lib_handle = NULL;
+	  else
+	    ni->library->lib_handle = __libc_dlopen (shlib_name);
+	
+	  if (ni->library->lib_handle == NULL)
+	    {
+	      /* Ok, really fail now.  */
+	      ni->library->lib_handle = (void *) -1l;
+	      __set_errno (saved_errno);
+	    }
 	}
 # ifdef USE_NSCD
       else if (is_nscd)