diff --git a/server/hostname.cpp b/server/hostname.cpp index af149458..88dc4c2b 100644 --- a/server/hostname.cpp +++ b/server/hostname.cpp @@ -11,7 +11,7 @@ #include #endif -std::string hostname() +static std::string _hostname() { #ifdef WIVRN_USE_GLIB GError * error = NULL; @@ -100,3 +100,10 @@ std::string hostname() U_LOG_W("Failed to get hostname"); return "no-hostname"; } + +std::string hostname() +{ + // Accessing hostname in child process fails with glib + static std::string result = _hostname(); + return result; +}