diff options
-rw-r--r-- | source/Host/posix/HostInfoPosix.cpp | 13 |
1 files changed, 1 insertions, 12 deletions
diff --git a/source/Host/posix/HostInfoPosix.cpp b/source/Host/posix/HostInfoPosix.cpp index 78300fca0..e7d0deef3 100644 --- a/source/Host/posix/HostInfoPosix.cpp +++ b/source/Host/posix/HostInfoPosix.cpp @@ -18,7 +18,6 @@ #include <grp.h> #include <limits.h> #include <mutex> -#include <netdb.h> #include <pwd.h> #include <stdlib.h> #include <sys/types.h> @@ -32,17 +31,7 @@ bool HostInfoPosix::GetHostname(std::string &s) { char hostname[PATH_MAX]; hostname[sizeof(hostname) - 1] = '\0'; if (::gethostname(hostname, sizeof(hostname) - 1) == 0) { - struct addrinfo hints; - struct addrinfo *res = nullptr; - std::memset(&hints, 0, sizeof(hints)); - hints.ai_flags = AI_CANONNAME; - int err = ::getaddrinfo(hostname, nullptr, &hints, &res); - if (err == 0) { - assert(res->ai_canonname && "getaddrinfo found a canonical name"); - s.assign(res->ai_canonname); - freeaddrinfo(res); - } else - s.assign(hostname); + s.assign(hostname); return true; } return false; |