ext/libuv/src/uv-common.c in libuv-0.11.5 vs ext/libuv/src/uv-common.c in libuv-0.11.7

- old
+ new

@@ -100,13 +100,11 @@ int uv_ip4_addr(const char* ip, int port, struct sockaddr_in* addr) { memset(addr, 0, sizeof(*addr)); addr->sin_family = AF_INET; addr->sin_port = htons(port); - /* TODO(bnoordhuis) Don't use inet_addr(), no good way to detect errors. */ - addr->sin_addr.s_addr = inet_addr(ip); - return 0; + return uv_inet_pton(AF_INET, ip, &(addr->sin_addr.s_addr)); } int uv_ip6_addr(const char* ip, int port, struct sockaddr_in6* addr) { #if defined(UV_PLATFORM_HAS_IP6_LINK_LOCAL_ADDRESS) @@ -138,13 +136,10 @@ addr->sin6_scope_id = if_nametoindex(zone_index); #endif } #endif - /* TODO(bnoordhuis) Return an error when the address is bad. */ - uv_inet_pton(AF_INET6, ip, &addr->sin6_addr); - - return 0; + return uv_inet_pton(AF_INET6, ip, &addr->sin6_addr); } int uv_ip4_name(struct sockaddr_in* src, char* dst, size_t size) { return uv_inet_ntop(AF_INET, &src->sin_addr, dst, size);