summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-01-18 09:56:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-01-18 09:56:22 +0000
commit3a47453d294550539dd26da02dfcecd5e09a4f0a (patch)
tree2bbf7528fca84246c3491401680810d4a3726430 /sysdeps/posix
parent9281f45d10af14f1f1dd884e8c77d293240c7412 (diff)
downloadglibc-3a47453d294550539dd26da02dfcecd5e09a4f0a.tar.gz
glibc-3a47453d294550539dd26da02dfcecd5e09a4f0a.tar.xz
glibc-3a47453d294550539dd26da02dfcecd5e09a4f0a.zip
Update.
	* sysdeps/posix/getaddrinfo.c: Correct modifications done for
	PR1515.  Patch by Hideaki YOSHIFUJI <yoshfuji@ecei.tohoku.ac.jp>.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 9b66676e1c..4bb80c8820 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -100,8 +100,8 @@ struct gaih_typeproto
 
 static struct gaih_typeproto gaih_inet_typeproto[] =
 {
-  { 0, 0, NULL },
-  { SOCK_STREAM, IPPROTO_TCP, (char *) "tcp" ,0 },
+  { 0, 0, NULL, 0 },
+  { SOCK_STREAM, IPPROTO_TCP, (char *) "tcp", 0 },
   { SOCK_DGRAM, IPPROTO_UDP, (char *) "udp", 0 },
   { SOCK_RAW, IPPROTO_RAW, (char *) "raw", GAI_PROTO_NOSERVICE },
   { 0, 0, NULL, 0 }
@@ -145,10 +145,10 @@ gaih_local (const char *name, const struct gaih_service *service,
       struct gaih_typeproto *tp = gaih_inet_typeproto + 1;
 
       while (tp->name != NULL
-	     && (req->ai_socktype != tp->socktype || req->ai_socktype == 0)
 	     && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0
-		 || req->ai_protocol != tp->protocol
-		 || req->ai_protocol == 0))
+		 || (req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
+		 || (req->ai_protocol != 0
+		     && req->ai_protocol != tp->protocol)))
 	++tp;
 
       if (tp->name == NULL)
@@ -299,10 +299,9 @@ gaih_inet (const char *name, const struct gaih_service *service,
       ++tp;
 
       while (tp->name != NULL
-	     && (req->ai_socktype != tp->socktype || req->ai_socktype == 0)
-	     && ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0
-		 || req->ai_protocol != tp->protocol
-		 || req->ai_protocol == 0))
+	     && ((req->ai_socktype != 0 && req->ai_socktype != tp->socktype)
+		 || (req->ai_protocol != 0
+		     && req->ai_protocol != tp->protocol)))
 	++tp;
 
       if (tp->name == NULL)
@@ -334,7 +333,12 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	      struct gaih_servtuple **pst = &st;
 	      for (tp++; tp->name; tp++)
 		{
-		  struct gaih_servtuple *newp = (struct gaih_servtuple *)
+		  struct gaih_servtuple *newp;
+
+		  if ((tp->protoflag & GAI_PROTO_NOSERVICE) != 0)
+		    continue;
+
+		  newp = (struct gaih_servtuple *)
 		    __alloca (sizeof (struct gaih_servtuple));
 
 		  if ((rc = gaih_inet_serv (service->name, tp, newp)))