Fix usage of gai_strerror.

GitOrigin-RevId: 2b17da3b3cbba8e4af91d9db54ee8adb01de6aed
This commit is contained in:
levlam 2018-05-17 21:21:19 +03:00
parent cb6c46071e
commit 5e4956f91b

View File

@ -159,7 +159,11 @@ Status IPAddress::init_host_port(CSlice host, CSlice port) {
LOG(INFO) << "Try to init IP address of " << host << " with port " << port;
auto s = getaddrinfo(host.c_str(), port.c_str(), &hints, &info);
if (s != 0) {
return Status::Error(PSLICE() << "getaddrinfo: " << gai_strerror(s));
#if TD_WINDOWS
return OS_SOCKET_ERROR("Failed to resolve host");
#else
return Status::Error(PSLICE() << "Failed to resolve host: " << gai_strerror(s));
#endif
}
SCOPE_EXIT {
freeaddrinfo(info);