serge-sans-paille created this revision. serge-sans-paille requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
According to the manpage The gethostbyname*() and gethostbyaddr*() functions are obsolete. Applications should use getaddrinfo(3) and getnameinfo(3) instead. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D104856 Files: lldb/tools/debugserver/source/RNBSocket.cpp Index: lldb/tools/debugserver/source/RNBSocket.cpp =================================================================== --- lldb/tools/debugserver/source/RNBSocket.cpp +++ 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;
Index: lldb/tools/debugserver/source/RNBSocket.cpp =================================================================== --- lldb/tools/debugserver/source/RNBSocket.cpp +++ 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;
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits