about summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2004-09-17 23:47:50 +0000
committerUlrich Drepper <drepper@redhat.com>2004-09-17 23:47:50 +0000
commitf04b1e1f0f86cce932ede5b5a088c0ec4712ce34 (patch)
treed92265f86e08f4d68637bb94fff8395f96c41980 /sysdeps/posix
parentf731666f48ff8545cda808739630bd474f024ce8 (diff)
downloadglibc-f04b1e1f0f86cce932ede5b5a088c0ec4712ce34.tar.gz
glibc-f04b1e1f0f86cce932ede5b5a088c0ec4712ce34.tar.xz
glibc-f04b1e1f0f86cce932ede5b5a088c0ec4712ce34.zip
[BZ #390]
Update.
2004-09-18  Jakub Jelinek  <jakub@redhat.com>

	* sysdeps/unix/sysv/linux/nscd_setup_thread.c (setup_thread):
	Do nothing if __NR_set_tid_address is not defined.  [BZ #390]

2004-09-17  Ulrich Drepper  <drepper@redhat.com>

	* sysdeps/posix/getaddrinfo.c: Use gethostbyname3_r NSS function
	in case it is available.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 9bf2537235..c8cb752b18 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -289,11 +289,12 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
   int herrno;								      \
   struct hostent th;							      \
   struct hostent *h;							      \
+  char *localcanon = NULL;						      \
   no_data = 0;								      \
   while (1) {								      \
     rc = 0;								      \
     status = DL_CALL_FCT (fct, (name, _family, &th, tmpbuf,		      \
-           tmpbuflen, &rc, &herrno));					      \
+			  tmpbuflen, &rc, &herrno, NULL, &localcanon));	      \
     if (rc != ERANGE || herrno != NETDB_INTERNAL)			      \
       break;								      \
     tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);		      \
@@ -342,16 +343,19 @@ gaih_inet_serv (const char *servicename, const struct gaih_typeproto *tp,
 	  pat = &((*pat)->next);					      \
 	}								      \
 									      \
+      if (localcanon !=	NULL)						      \
+	canon = strdupa (localcanon);					      \
+									      \
       if (_family == AF_INET6 && i > 0)					      \
 	got_ipv6 = true;						      \
     }									      \
  }
 
 
-typedef enum nss_status (*nss_gethostbyname2_r)
+typedef enum nss_status (*nss_gethostbyname3_r)
   (const char *name, int af, struct hostent *host,
    char *buffer, size_t buflen, int *errnop,
-   int *h_errnop);
+   int *h_errnop, int32_t *ttlp, char **canonp);
 typedef enum nss_status (*nss_getcanonname_r)
   (const char *name, char *buffer, size_t buflen, char **result,
    int *errnop, int *h_errnop);
@@ -771,8 +775,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
 
 	  while (!no_more)
 	    {
-	      nss_gethostbyname2_r fct
-		= __nss_lookup_function (nip, "gethostbyname2_r");
+	      nss_gethostbyname3_r fct
+		= __nss_lookup_function (nip, "gethostbyname3_r");
+	      if (fct == NULL)
+		/* We are cheating here.  The gethostbyname2_r function does
+		   not have the same interface as gethostbyname3_r but the
+		   extra arguments the latter takes are added at the end.
+		   So the gethostbyname2_r code will just ignore them.  */
+		fct = __nss_lookup_function (nip, "gethostbyname2_r");
 
 	      if (fct != NULL)
 		{
@@ -805,7 +815,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 		  if (inet6_status == NSS_STATUS_SUCCESS
 		      || status == NSS_STATUS_SUCCESS)
 		    {
-		      if ((req->ai_flags & AI_CANONNAME) != 0)
+		      if ((req->ai_flags & AI_CANONNAME) != 0 && canon == NULL)
 			{
 			  /* If we need the canonical name, get it
 			     from the same service as the result.  */