ソースを参照

getaddrinfo.c: fix incorrect check for ERANGE from gethostbyaddr_r

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

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Denys Vlasenko 13 年 前
コミット
408763f326
1 ファイル変更2 行追加2 行削除
  1. 2 2
      libc/inet/getaddrinfo.c

+ 2 - 2
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);
 				}