From 5e4956f91bb4b166a7df258df13b7236356c4f70 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 17 May 2018 21:21:19 +0300 Subject: [PATCH] Fix usage of gai_strerror. GitOrigin-RevId: 2b17da3b3cbba8e4af91d9db54ee8adb01de6aed --- tdutils/td/utils/port/IPAddress.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tdutils/td/utils/port/IPAddress.cpp b/tdutils/td/utils/port/IPAddress.cpp index f8c525af..1fa9c5fd 100644 --- a/tdutils/td/utils/port/IPAddress.cpp +++ b/tdutils/td/utils/port/IPAddress.cpp @@ -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);