summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2006-08-28 19:19:33 +0000
committerJakub Jelinek <jakub@redhat.com>2006-08-28 19:19:33 +0000
commit2455d11258712bbab8a52c7951301924a483a295 (patch)
tree3677c7e4c7ba3c4197a0d21734e53749d04ddfff /inet
parent0afdbd1873d970cfaa724d7d49226685a07d6f05 (diff)
downloadglibc-2455d11258712bbab8a52c7951301924a483a295.tar.gz
glibc-2455d11258712bbab8a52c7951301924a483a295.tar.xz
glibc-2455d11258712bbab8a52c7951301924a483a295.zip
Updated to fedora-glibc-20060828T1903 cvs/fedora-glibc-2_4_90-26
Diffstat (limited to 'inet')
-rw-r--r--inet/getnameinfo.c71
1 files changed, 30 insertions, 41 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 5057fd221a..b7b2b151b2 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -203,48 +203,40 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 	if (!(flags & NI_NUMERICHOST))
 	  {
 	    struct hostent *h = NULL;
+	    if (sa->sa_family == AF_INET6)
+	      {
+		while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
+					  sizeof(struct in6_addr),
+					  AF_INET6, &th, tmpbuf, tmpbuflen,
+					  &h, &herrno))
+		  if (herrno == NETDB_INTERNAL && errno == ERANGE)
+		    tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
+		  else
+		    break;
+	      }
+	    else
+	      {
+		while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
+					  sizeof(struct in_addr), AF_INET,
+					  &th, tmpbuf, tmpbuflen,
+					  &h, &herrno))
+		  if (herrno == NETDB_INTERNAL && errno == ERANGE)
+		    tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen);
+		  else
+		    break;
+	      }
+
 	    if (h == NULL)
 	      {
-		if (sa->sa_family == AF_INET6)
+		if (herrno == NETDB_INTERNAL)
 		  {
-		    while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in6 *) sa)->sin6_addr),
-					      sizeof(struct in6_addr),
-					      AF_INET6, &th, tmpbuf, tmpbuflen,
-					      &h, &herrno))
-		      {
-			if (herrno == NETDB_INTERNAL)
-			  {
-			    if (errno == ERANGE)
-			      tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-						      2 * tmpbuflen);
-			    else
-			      {
-				__set_h_errno (herrno);
-				__set_errno (serrno);
-				return EAI_SYSTEM;
-			      }
-			  }
-			else
-			  {
-			    break;
-			  }
-		      }
+		    __set_h_errno (herrno);
+		    return EAI_SYSTEM;
 		  }
-		else
+		if (herrno == TRY_AGAIN)
 		  {
-		    while (__gethostbyaddr_r ((const void *) &(((const struct sockaddr_in *)sa)->sin_addr),
-					      sizeof(struct in_addr), AF_INET,
-					      &th, tmpbuf, tmpbuflen,
-					      &h, &herrno))
-		      {
-			if (errno == ERANGE)
-			  tmpbuf = extend_alloca (tmpbuf, tmpbuflen,
-						  2 * tmpbuflen);
-			else
-			  {
-			    break;
-			  }
-		      }
+		    __set_h_errno (herrno);
+		    return EAI_AGAIN;
 		  }
 	      }
 
@@ -361,10 +353,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
 				 (const void *) &(((const struct sockaddr_in *) sa)->sin_addr),
 				 host, hostlen);
 		if (c == NULL)
-		  {
-		    __set_errno (serrno);
-		    return EAI_SYSTEM;
-		  }
+		  return EAI_SYSTEM;
 	      }
 	    ok = 1;
 	  }