diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2011-04-15 01:24:50 +0200 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2012-06-15 14:00:37 +0200 |
commit | d9f20698ed8726d416a87b9d92c15c4f1781042d (patch) | |
tree | 20d218e99d755d5f289060cc74c468cca29009da /libc | |
parent | d33a8aba6a57f0eaed0bc236fdab595d72ed6532 (diff) |
resolv.c: shrink code a bit in getnameinfo.
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
Diffstat (limited to 'libc')
-rw-r--r-- | libc/inet/resolv.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c index 692991f94..e9f550b94 100644 --- a/libc/inet/resolv.c +++ b/libc/inet/resolv.c @@ -1774,7 +1774,7 @@ int getnameinfo(const struct sockaddr *sa, unsigned flags) { int serrno = errno; - unsigned ok; + bool ok = 0; struct hostent *hoste = NULL; char domain[256]; @@ -1784,16 +1784,15 @@ int getnameinfo(const struct sockaddr *sa, if (sa == NULL || addrlen < sizeof(sa_family_t)) return EAI_FAMILY; - ok = sa->sa_family; - if (ok == AF_LOCAL) /* valid */; + if (sa->sa_family == AF_LOCAL) /* valid */; #ifdef __UCLIBC_HAS_IPV4__ - else if (ok == AF_INET) { + else if (sa->sa_family == AF_INET) { if (addrlen < sizeof(struct sockaddr_in)) return EAI_FAMILY; } #endif #ifdef __UCLIBC_HAS_IPV6__ - else if (ok == AF_INET6) { + else if (sa->sa_family == AF_INET6) { if (addrlen < sizeof(struct sockaddr_in6)) return EAI_FAMILY; } @@ -1801,7 +1800,6 @@ int getnameinfo(const struct sockaddr *sa, else return EAI_FAMILY; - ok = 0; if (host != NULL && hostlen > 0) switch (sa->sa_family) { case AF_INET: |