about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-08-19 21:39:39 +0000
committerUlrich Drepper <drepper@redhat.com>2004-08-19 21:39:39 +0000
commitafd7b703335c65d616b6198c1aa407cfbba5edea (patch)
tree6a20f92b41d0bc84715657b865555226584c0afe /sysdeps
parent8583671dd4d0fb367f41963739c814838a2025e3 (diff)
downloadglibc-afd7b703335c65d616b6198c1aa407cfbba5edea.tar.gz
glibc-afd7b703335c65d616b6198c1aa407cfbba5edea.tar.xz
glibc-afd7b703335c65d616b6198c1aa407cfbba5edea.zip
Update.
	* sysdeps/posix/getaddrinfo.c (gaih_inet): Don't use
	getcanonname_r function if AI_CANONNAME flag is not set in
	request.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/posix/getaddrinfo.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 2d89b4ad5f..132fdcc620 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -644,27 +644,30 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  if (inet6_status == NSS_STATUS_SUCCESS
 		      || status == NSS_STATUS_SUCCESS)
 		    {
-		      /* If we need the canonical name, get it from the same
-			 service as the result.  */
-		      nss_getcanonname_r cfct;
-		      int herrno;
-
-		      cfct = __nss_lookup_function (nip, "getcanonname_r");
-		      if (cfct != NULL)
+		      if ((req->ai_flags & AI_CANONNAME) != 0)
 			{
-			  const size_t max_fqdn_len = 256;
-			  char *buf = alloca (max_fqdn_len);
-			  char *s;
-
-			  if (DL_CALL_FCT (cfct, (h->h_name ?: name, buf,
-						  max_fqdn_len, &s, &rc,
-						  &herrno))
-			      == NSS_STATUS_SUCCESS)
-			    canon = s;
-			  else
-			    /* Set to name now to avoid using
-			       gethostbyaddr.  */
-			    canon = name;
+			  /* If we need the canonical name, get it
+			     from the same service as the result.  */
+			  nss_getcanonname_r cfct;
+			  int herrno;
+
+			  cfct = __nss_lookup_function (nip, "getcanonname_r");
+			  if (cfct != NULL)
+			    {
+			      const size_t max_fqdn_len = 256;
+			      char *buf = alloca (max_fqdn_len);
+			      char *s;
+
+			      if (DL_CALL_FCT (cfct, (h->h_name ?: name, buf,
+						      max_fqdn_len, &s, &rc,
+						      &herrno))
+				  == NSS_STATUS_SUCCESS)
+				canon = s;
+			      else
+				/* Set to name now to avoid using
+				   gethostbyaddr.  */
+				canon = name;
+			    }
 			}
 
 		      break;