[git commit prelink] getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_r

Denys Vlasenko dvlasenk at redhat.com
Wed May 4 04:56:14 UTC 2011


commit: http://git.uclibc.org/uClibc/commit/?id=408763f32676fa60e74cb202486be4b17a43974e
branch: http://git.uclibc.org/uClibc/commit/?id=refs/heads/prelink

Also, freeaddrinfo(NULL) is ok, no need to check parameted for NULL
before calling it.

Signed-off-by: Denys Vlasenko <dvlasenk at redhat.com>
---
 libc/inet/getaddrinfo.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index e619eff..1a77c51 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -649,7 +649,7 @@ gaih_inet(const char *name, const struct gaih_service *service,
 						at2->family,
 						&th, tmpbuf, tmpbuflen,
 						&h, &herrno);
-				} while (rc == errno && herrno == NETDB_INTERNAL);
+				} while (rc == ERANGE && herrno == NETDB_INTERNAL);
 
 				if (rc != 0 && herrno == NETDB_INTERNAL) {
 					__set_h_errno(herrno);
@@ -855,7 +855,7 @@ getaddrinfo(const char *name, const char *service,
 					last_i = i;
 					if (hints->ai_family == AF_UNSPEC && (i & GAIH_OKIFUNSPEC))
 						continue;
-					if (p)
+					/*if (p) - freeaddrinfo works ok on NULL too */
 						freeaddrinfo(p);
 					return -(i & GAIH_EAI);
 				}
-- 
1.7.3.4



More information about the uClibc-cvs mailing list