about summary refs log tree commit diff
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-04-23 17:19:51 +0000
committerUlrich Drepper <drepper@redhat.com>2003-04-23 17:19:51 +0000
commit2d37d6da83e43bdf1d13a0519fb580612ebae76e (patch)
tree778fa0905e17d7ab9430932671d947945017db1a
parent950094f827cd10ee03bedbb9219cef325b1c03cf (diff)
downloadglibc-2d37d6da83e43bdf1d13a0519fb580612ebae76e.tar.gz
glibc-2d37d6da83e43bdf1d13a0519fb580612ebae76e.tar.xz
glibc-2d37d6da83e43bdf1d13a0519fb580612ebae76e.zip
(gaih_inet): Check for rc == ERANGE, not rc == errno. Use extend_alloca.
-rw-r--r--sysdeps/posix/getaddrinfo.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index dd6e4155a1..e016876b6c 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -677,13 +677,11 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	    int herrno;
 	    struct hostent th;
 	    size_t tmpbuflen = 512;
-	    char *tmpbuf;
+	    char *tmpbuf = NULL;
 
 	    do
 	      {
-		tmpbuflen *= 2;
-		tmpbuf = __alloca (tmpbuflen);
-
+		tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
 		rc = __gethostbyaddr_r (at2->addr,
 					((at2->family == AF_INET6)
 					 ? sizeof(struct in6_addr)
@@ -692,7 +690,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
 					&h, &herrno);
 
 	      }
-	    while (rc == errno && herrno == NETDB_INTERNAL);
+	    while (rc == ERANGE && herrno == NETDB_INTERNAL);
 
 	    if (rc != 0 && herrno == NETDB_INTERNAL)
 	      {