Only request hostname once

This commit is contained in:
Patrick Nicolas
2024-08-18 09:25:25 +02:00
parent 6da658bcfb
commit 1c445024d7
+8 -1
View File
@@ -11,7 +11,7 @@
#include <systemd/sd-bus.h>
#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;
}