[git commit] resolv.c: shrink code a bit in getnameinfo.
Bernhard Reutner-Fischer
rep.dot.nop at gmail.com
Fri Jun 15 12:00:37 UTC 2012
commit: http://git.uclibc.org/uClibc/commit/?id=d9f20698ed8726d416a87b9d92c15c4f1781042d
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/master
Signed-off-by: Peter S. Mazinger <ps.m at gmx.net>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop at gmail.com>
---
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 692991f..e9f550b 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:
More information about the uClibc-cvs
mailing list