X-Git-Url: http://git.csclub.uwaterloo.ca/?p=kopensolaris-gnu%2Fglibc.git;a=blobdiff_plain;f=nss%2Fnsswitch.c;h=c968502cdfa4482bc99be25194fbce6c6b66e6f6;hp=65da26b1852a5074eabbda0082460ef8f65115cc;hb=c4f2ca5fddd04ccecb2a90a79865b4bca21a513c;hpb=eaa5903bee9c89638d3f726aff6cd06134dbb4f9;ds=sidebyside diff --git a/nss/nsswitch.c b/nss/nsswitch.c index 65da26b185..c968502cdf 100644 --- a/nss/nsswitch.c +++ b/nss/nsswitch.c @@ -22,11 +22,11 @@ #include #include #include -#include /* We need some help from ld.so. */ #include #include #include #include +#include /* We need some help from ld.so. */ #if !defined DO_STATIC_NSS || defined PIC # include @@ -68,7 +68,6 @@ static struct __libc_lock_define_initialized (static, lock) - #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; @@ -136,7 +135,7 @@ __nss_database_lookup (const char *database, const char *alternate_name, /* -1 == not found - 0 == adjusted for next function + 0 == function found 1 == finished */ int __nss_lookup (service_user **ni, const char *fct_name, void **fctp) @@ -253,10 +252,9 @@ static int nss_dlerror_run (void (*operate) (void *), void *args) { char *last_errstring = NULL; - const char *last_object_name = NULL; int result; - (void) _dl_catch_error (&last_errstring, &last_object_name, operate, args); + (void) _dl_catch_error (&last_errstring, operate, args); result = last_errstring != NULL; if (result) @@ -380,7 +378,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 +391,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)