about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-02-23 19:54:06 +0000
committerUlrich Drepper <drepper@redhat.com>2004-02-23 19:54:06 +0000
commit5605e1177d4728b66b92cb5012810b5feda1ec4b (patch)
treeb65a493bf9b40bb2291d96739c59e01eb392e10d /sysdeps
parenta8fd5a02d94dcbe9a75252a66d2d73b41b9a2c83 (diff)
downloadglibc-5605e1177d4728b66b92cb5012810b5feda1ec4b.tar.gz
glibc-5605e1177d4728b66b92cb5012810b5feda1ec4b.tar.xz
glibc-5605e1177d4728b66b92cb5012810b5feda1ec4b.zip
Update.
2004-02-23  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/posix/getaddrinfo.c (gaih_inet): If _res has not been
	inited yet, try to init it before saving old _res.options.
	* posix/Makefile (xtests): Add bug-ga2.
	(generated): Add bug-ga2.mtrace and bug-ga2-mem.
	(xtests): Depend on bug-ga2-mem.
	($(objpfx)bug-ga2-mem, bug-ga2-ENV): New.
	* posix/bug-ga2.c: New test.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/getaddrinfo.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 7c192bf2eb..afdefdfb52 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -604,8 +604,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  struct gaih_addrtuple **pat = &at;
 	  int no_data = 0;
 	  int no_inet6_data = 0;
-	  int old_res_options = _res.options;
-
 	  /* If we are looking for both IPv4 and IPv6 address we don't
 	     want the lookup functions to automatically promote IPv4
 	     addresses to IPv6 addresses.  Currently this is decided
@@ -616,6 +614,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	      enum nss_status inet6_status, status = NSS_STATUS_UNAVAIL;
 	      int no_more;
 	      nss_gethostbyname2_r fct;
+	      int old_res_options;
 
 	      if (__nss_hosts_database != NULL)
 		{
@@ -626,6 +625,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		no_more = __nss_database_lookup ("hosts", NULL,
 						 "dns [!UNAVAIL=return] files", &nip);
 
+	      if ((_res.options & RES_INIT) == 0 && __res_ninit(&_res) == -1)
+		no_more = 1;
+	      old_res_options = _res.options;
 	      _res.options &= ~RES_USE_INET6;
 
 	      while (!no_more)