Skip to content

Commit

Permalink
Merge pull request #1 from ustcdane/ustcdane-patch-1
Browse files Browse the repository at this point in the history
add NetUtils::GetIP gethostbyname  check info.
  • Loading branch information
ustcdane committed Dec 30, 2019
2 parents 04cc049 + b2fa4c8 commit ba9f50e
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions xdl/ps-plus/ps-plus/common/net_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ bool NetUtils::GetIP(std::vector<std::string>& ips) {
}
struct hostent* hent;
hent = gethostbyname(hostName.c_str());
PS_CHECK(hent) << " error! Can not get host [" << hostName << "]\'s host entry.(Please check /etc/hosts)!\n";
for (uint32_t i = 0; hent->h_addr_list[i]; i++) {
std::string ip = inet_ntoa(*(struct in_addr*)(hent->h_addr_list[i]));
ips.push_back(ip);
Expand Down

0 comments on commit ba9f50e

Please sign in to comment.