Skip to content

Commit

Permalink
Fix getaddrinfo on FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed Jun 24, 2024
1 parent 7af2226 commit 454daba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/collective/socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ namespace xgboost::collective {
SockAddress MakeSockAddress(StringView host, in_port_t port) {
struct addrinfo hints;
std::memset(&hints, 0, sizeof(hints));
hints.ai_protocol = SOCK_STREAM;
hints.ai_socktype = SOCK_STREAM;
struct addrinfo *res = nullptr;
int sig = getaddrinfo(host.c_str(), nullptr, &hints, &res);
if (sig != 0) {
LOG(FATAL) << "Failed to get addr info for: " << host << ":" << port
LOG(FATAL) << "Failed to get addr info for: " << host
<< ", error: " << gai_strerror(sig);
return {};
}
Expand All @@ -46,7 +46,7 @@ SockAddress MakeSockAddress(StringView host, in_port_t port) {
freeaddrinfo(res);
return SockAddress{v};
} else {
LOG(FATAL) << "Failed to get addr info for: " << host << ":" << port;
LOG(FATAL) << "Failed to get addr info for: " << host;
}

return SockAddress{};
Expand Down

0 comments on commit 454daba

Please sign in to comment.