Only request hostname once
This commit is contained in:
+8
-1
@@ -11,7 +11,7 @@
|
|||||||
#include <systemd/sd-bus.h>
|
#include <systemd/sd-bus.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::string hostname()
|
static std::string _hostname()
|
||||||
{
|
{
|
||||||
#ifdef WIVRN_USE_GLIB
|
#ifdef WIVRN_USE_GLIB
|
||||||
GError * error = NULL;
|
GError * error = NULL;
|
||||||
@@ -100,3 +100,10 @@ std::string hostname()
|
|||||||
U_LOG_W("Failed to get hostname");
|
U_LOG_W("Failed to get hostname");
|
||||||
return "no-hostname";
|
return "no-hostname";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string hostname()
|
||||||
|
{
|
||||||
|
// Accessing hostname in child process fails with glib
|
||||||
|
static std::string result = _hostname();
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user