diff options
author | Ulrich Drepper <drepper@redhat.com> | 2006-08-28 16:24:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2006-08-28 16:24:10 +0000 |
commit | 6e31011191823a5d7dc65632f4be8a87fcf0779b (patch) | |
tree | 966cd58c385575fbe94afea770a16bffa90e169f /inet | |
parent | 07014fcacd42d0d3a3178cb7f6b498284ae9b2c0 (diff) | |
download | glibc-6e31011191823a5d7dc65632f4be8a87fcf0779b.tar.gz glibc-6e31011191823a5d7dc65632f4be8a87fcf0779b.tar.xz glibc-6e31011191823a5d7dc65632f4be8a87fcf0779b.zip |
* inet/getnameinfo.c (getnameinfo): For AF_INET, check errno cvs/fedora-glibc-20060828T1903
only if herrno is NETDB_INTERNAL. Handle errors other than ERANGE outside of the loops, handle TRY_AGAIN. * locale/programs/ld-ctype.c (translit_flatten): Issue error if other's ctype category was missing. * locale/programs/ld-collate.c (collate_read): Return if copy_locale's collate category is missing.
Diffstat (limited to 'inet')
-rw-r--r-- | inet/getnameinfo.c | 71 |
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; } |