diff --git a/lldb/tools/debugserver/source/RNBSocket.cpp b/lldb/tools/debugserver/source/RNBSocket.cpp --- a/lldb/tools/debugserver/source/RNBSocket.cpp +++ b/lldb/tools/debugserver/source/RNBSocket.cpp @@ -50,10 +50,9 @@ if (inet_pton_result == 1) return true; - struct hostent *host_entry = gethostbyname(hostname); - if (host_entry) { - std::string ip_str( - ::inet_ntoa(*(struct in_addr *)*host_entry->h_addr_list)); + struct addrinfo *addr = nullptr; + if (getaddrinfo(hostname, nullptr, 0, &addr) == 0) { + std::string ip_str(::inet_ntoa(addr->ai_addr->sin_addr); inet_pton_result = ::inet_pton(AF_INET, ip_str.c_str(), &addr); if (inet_pton_result == 1) return true;