* sysdeps/posix/getaddrinfo.c (gaih_inet): After gethostbyname4_r
authorUlrich Drepper <drepper@redhat.com>
Fri, 16 May 2008 15:36:26 +0000 (15:36 +0000)
committerUlrich Drepper <drepper@redhat.com>
Fri, 16 May 2008 15:36:26 +0000 (15:36 +0000)
lookup, don't assign canon unconditionally.

ChangeLog
sysdeps/posix/getaddrinfo.c

index 28b65e3e6a85f82635c9dcd7c44124e346f02aae..01dd75a433a7040b7574964ca4dfc5c40d7673e6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2008-05-16  Ulrich Drepper  <drepper@redhat.com>
+
+       * sysdeps/posix/getaddrinfo.c (gaih_inet): After gethostbyname4_r
+       lookup, don't assign canon unconditionally.
+
 2008-05-14  Ulrich Drepper  <drepper@redhat.com>
 
        * string/Makefile (distribute): Add str-two-way.h.
index 8908fc10c3a87464f9f7f3ae2bc6d55aa00562cd..2515d23c266526291d10125453662c90b098542b 100644 (file)
@@ -729,7 +729,8 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
                  if (status == NSS_STATUS_SUCCESS)
                    {
-                     canon = (*pat)->name;
+                     if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
+                       canon = (*pat)->name;
 
                      while (*pat != NULL)
                        pat = &((*pat)->next);
@@ -953,7 +954,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
                    return -EAI_IDN_ENCODE;
                  }
                /* In case the output string is the same as the input
-                  string no new string has been allocated.  Otherwise
+                  string no new string has been allocated and we
                   make a copy.  */
                if (out == canon)
                  goto make_copy;