diff --git a/adb/sysdeps.h b/adb/sysdeps.h index 3ed589c71..ded821426 100644 --- a/adb/sysdeps.h +++ b/adb/sysdeps.h @@ -594,7 +594,7 @@ inline int _fd_set_error_str(int fd, std::string* error) { } inline int network_loopback_client(int port, int type, std::string* error) { - return _fd_set_error_str(socket_loopback_client(port, type), error); + return _fd_set_error_str(socket_network_client("localhost", port, type), error); } inline int network_loopback_server(int port, int type, std::string* error) { diff --git a/libcutils/socket_loopback_client_unix.c b/libcutils/socket_loopback_client_unix.c index e14cffbe9..137e369c2 100644 --- a/libcutils/socket_loopback_client_unix.c +++ b/libcutils/socket_loopback_client_unix.c @@ -35,23 +35,6 @@ */ int socket_loopback_client(int port, int type) { - struct sockaddr_in addr; - int s; - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_port = htons(port); - addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - - s = socket(AF_INET, type, 0); - if(s < 0) return -1; - - if(connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) { - close(s); - return -1; - } - - return s; - + return socket_network_client("localhost", port, type); }