Unify GetHostname() and use libuv implementation (#1391)

This commit is contained in:
Peter Johnson
2018-10-28 19:01:48 -07:00
committed by GitHub
parent a8aacd3657
commit 9a1af132bf
6 changed files with 37 additions and 54 deletions

View File

@@ -14,13 +14,6 @@
namespace cs {
std::string GetHostname() {
char name[256];
if (::gethostname(name, sizeof(name)) != 0) return "";
name[255] = '\0'; // Per POSIX, may not be null terminated if too long
return name;
}
std::vector<std::string> GetNetworkInterfaces() {
struct ifaddrs* ifa;
if (::getifaddrs(&ifa) != 0) return std::vector<std::string>{};