about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-06 08:15:50 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-06 08:15:50 +0000
commitb0d8b23d61009f2681b930c66be595df193b0f55 (patch)
treeb086fe1710ad4e260f8d35ae595a103a455cac6b
parent6029b952a671027cceb9e158ab2e91f7714caf7e (diff)
downloadglibc-b0d8b23d61009f2681b930c66be595df193b0f55.tar.gz
glibc-b0d8b23d61009f2681b930c66be595df193b0f55.tar.xz
glibc-b0d8b23d61009f2681b930c66be595df193b0f55.zip
(gaih_inet): Fix problem with AF_UNSPEC lookup with AI_CANONNAME of name which has only IPv6 addresses.
-rw-r--r--sysdeps/posix/getaddrinfo.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 3ffa329f73..17331e54bc 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -88,6 +88,7 @@ static const struct gaih_servtuple nullserv;
 struct gaih_addrtuple
   {
     struct gaih_addrtuple *next;
+    char *name;
     int family;
     uint32_t addr[4];
     uint32_t scopeid;
@@ -321,6 +322,7 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
 	    }								      \
 	  uint32_t *addr = (*pat)->addr;				      \
 	  (*pat)->next = NULL;						      \
+	  (*pat)->name = i == 0 ? strdupa (h->h_name) : NULL;		      \
 	  if (_family == AF_INET && req->ai_family == AF_INET6)		      \
 	    {								      \
 	      (*pat)->family = AF_INET6;				      \
@@ -658,7 +660,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 			      char *buf = alloca (max_fqdn_len);
 			      char *s;
 
-			      if (DL_CALL_FCT (cfct, (h->h_name ?: name, buf,
+			      if (DL_CALL_FCT (cfct, (at->name ?: name, buf,
 						      max_fqdn_len, &s, &rc,
 						      &herrno))
 				  == NSS_STATUS_SUCCESS)