From b2179107f3eabb5e349333cd5adc6e2fb4431990 Mon Sep 17 00:00:00 2001 From: Andreas Schwab Date: Thu, 24 Jan 2013 12:32:09 +0100 Subject: Properly cache the result from looking up the nss database config --- sysdeps/posix/getaddrinfo.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 52177e454c..170ad8c400 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -558,7 +558,7 @@ gaih_inet (const char *name, const struct gaih_service *service, struct gaih_addrtuple **pat = &at; int no_data = 0; int no_inet6_data = 0; - service_user *nip = NULL; + service_user *nip; enum nss_status inet6_status = NSS_STATUS_UNAVAIL; enum nss_status status = NSS_STATUS_UNAVAIL; int no_more; @@ -791,15 +791,13 @@ gaih_inet (const char *name, const struct gaih_service *service, } #endif - if (__nss_hosts_database != NULL) - { - no_more = 0; - nip = __nss_hosts_database; - } - else + if (__nss_hosts_database == NULL) no_more = __nss_database_lookup ("hosts", NULL, "dns [!UNAVAIL=return] files", - &nip); + &__nss_hosts_database); + else + no_more = 0; + nip = __nss_hosts_database; /* Initialize configurations. */ if (__glibc_unlikely (!_res_hconf.initialized)) -- cgit 1.4.1