diff options
Diffstat (limited to 'inet/getnameinfo.c')
-rw-r--r-- | inet/getnameinfo.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c index 493a423c10..5057fd221a 100644 --- a/inet/getnameinfo.c +++ b/inet/getnameinfo.c @@ -403,25 +403,16 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host, if (!(flags & NI_NUMERICSERV)) { struct servent *s, ts; - while (__getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, - ((flags & NI_DGRAM) ? "udp" : "tcp"), - &ts, tmpbuf, tmpbuflen, &s)) + int e; + while ((e = __getservbyport_r (((const struct sockaddr_in *) sa)->sin_port, + ((flags & NI_DGRAM) + ? "udp" : "tcp"), + &ts, tmpbuf, tmpbuflen, &s))) { - if (herrno == NETDB_INTERNAL) - { - if (errno == ERANGE) - tmpbuf = extend_alloca (tmpbuf, tmpbuflen, - 2 * tmpbuflen); - else - { - __set_errno (serrno); - return EAI_SYSTEM; - } - } + if (e == ERANGE) + tmpbuf = extend_alloca (tmpbuf, tmpbuflen, 2 * tmpbuflen); else - { - break; - } + break; } if (s) { |