summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-16 15:36:26 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-16 15:36:26 +0000
commit91c8a74b8b9f7bf24aae101190750c2ec7b9ab23 (patch)
treef4032764b653c8574abf250c353c30d2e04a109e
parent0caca71ac95d12c6f45bbbe39d9adb7ac7074146 (diff)
downloadglibc-91c8a74b8b9f7bf24aae101190750c2ec7b9ab23.tar.gz
glibc-91c8a74b8b9f7bf24aae101190750c2ec7b9ab23.tar.xz
glibc-91c8a74b8b9f7bf24aae101190750c2ec7b9ab23.zip
* sysdeps/posix/getaddrinfo.c (gaih_inet): After gethostbyname4_r
	lookup, don't assign canon unconditionally.
-rw-r--r--ChangeLog5
-rw-r--r--sysdeps/posix/getaddrinfo.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 28b65e3e6a..01dd75a433 100644
--- 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.
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 8908fc10c3..2515d23c26 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -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;