Properly handle dbus errors when getting hostname
This commit is contained in:
@@ -14,6 +14,7 @@ static std::string _hostname()
|
|||||||
if (!con)
|
if (!con)
|
||||||
{
|
{
|
||||||
U_LOG_W("Failed to connect to system bus: %s", error->message);
|
U_LOG_W("Failed to connect to system bus: %s", error->message);
|
||||||
|
g_error_free(error);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -32,7 +33,11 @@ static std::string _hostname()
|
|||||||
&error);
|
&error);
|
||||||
|
|
||||||
if (error)
|
if (error)
|
||||||
|
{
|
||||||
|
g_error_free(error);
|
||||||
|
error = NULL;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
GVariant * property_value;
|
GVariant * property_value;
|
||||||
g_variant_get(result, "(v)", &property_value);
|
g_variant_get(result, "(v)", &property_value);
|
||||||
|
|||||||
Reference in New Issue
Block a user