(gaih_inet): Check for rc == ERANGE, not rc == errno. Use extend_alloca.

This commit is contained in:
Ulrich Drepper 2003-04-23 17:19:51 +00:00
parent 950094f827
commit 2d37d6da83
1 changed files with 3 additions and 5 deletions

View File

@ -677,13 +677,11 @@ gaih_inet (const char *name, const struct gaih_service *service,
int herrno; int herrno;
struct hostent th; struct hostent th;
size_t tmpbuflen = 512; size_t tmpbuflen = 512;
char *tmpbuf; char *tmpbuf = NULL;
do do
{ {
tmpbuflen *= 2; tmpbuf = extend_alloca (tmpbuf, tmpbuflen, tmpbuflen * 2);
tmpbuf = __alloca (tmpbuflen);
rc = __gethostbyaddr_r (at2->addr, rc = __gethostbyaddr_r (at2->addr,
((at2->family == AF_INET6) ((at2->family == AF_INET6)
? sizeof(struct in6_addr) ? sizeof(struct in6_addr)
@ -692,7 +690,7 @@ gaih_inet (const char *name, const struct gaih_service *service,
&h, &herrno); &h, &herrno);
} }
while (rc == errno && herrno == NETDB_INTERNAL); while (rc == ERANGE && herrno == NETDB_INTERNAL);
if (rc != 0 && herrno == NETDB_INTERNAL) if (rc != 0 && herrno == NETDB_INTERNAL)
{ {