summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-06-19 00:01:42 +0000
committerUlrich Drepper <drepper@redhat.com>2004-06-19 00:01:42 +0000
commit163288fe2e01f9b68febb184795bf4a1d9776874 (patch)
tree6029712796be668a9e9226d529ba1f90452c78d7
parent5a6ae8da1d0283a88e85ec5be34ecfb8523393e5 (diff)
downloadglibc-163288fe2e01f9b68febb184795bf4a1d9776874.tar.gz
glibc-163288fe2e01f9b68febb184795bf4a1d9776874.tar.xz
glibc-163288fe2e01f9b68febb184795bf4a1d9776874.zip
Update.
	* sysdeps/posix/getaddrinfo.c (gaih_inet): For AI_CANONNAME,
	determine the canonical name only for the first returned entry.
-rw-r--r--ChangeLog3
-rw-r--r--sysdeps/posix/getaddrinfo.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index a601f02e96..b4b3447185 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2004-06-18  Ulrich Drepper  <drepper@redhat.com>
 
+	* sysdeps/posix/getaddrinfo.c (gaih_inet): For AI_CANONNAME,
+	determine the canonical name only for the first returned entry.
+
 	* inet/bug-if1.c: New file.
 	* inet/Makefile (tests): Add bug-if1.
 
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index e3b83e5ea1..bc5f0699a3 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -762,7 +762,6 @@ gaih_inet (const char *name, const struct gaih_service *service,
     return 0;
 
   {
-    const char *c = NULL;
     struct gaih_servtuple *st2;
     struct gaih_addrtuple *at2 = at;
     size_t socklen, namelen;
@@ -773,7 +772,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
      */
     while (at2 != NULL)
       {
-	if (req->ai_flags & AI_CANONNAME)
+	const char *c = NULL;
+
+	/* Only the first entry gets the canonical name.  */
+	if (at2 == at && (req->ai_flags & AI_CANONNAME) != 0)
 	  {
 	    struct hostent *h = NULL;