about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2013-01-24 12:32:09 +0100
committerAndreas Schwab <schwab@suse.de>2013-09-30 10:29:13 +0200
commitb2179107f3eabb5e349333cd5adc6e2fb4431990 (patch)
tree1a723f6ae54607a352f17983db026987734cf10c /sysdeps/posix
parent47f28d0a6627c8b263df3c3e8f905bfaf42557bc (diff)
downloadglibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.tar.gz
glibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.tar.xz
glibc-b2179107f3eabb5e349333cd5adc6e2fb4431990.zip
Properly cache the result from looking up the nss database config
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c14
1 files changed, 6 insertions, 8 deletions
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))