GDBusProxy: Treat org.freedesktop.systemd1.Masked error as non-fatal

This is useful otherwise we'll fail if a systemd service is
masked. See bug 677718 for details.

https://bugzilla.gnome.org/show_bug.cgi?id=677718

Signed-off-by: David Zeuthen <zeuthen@gmail.com>
This commit is contained in:
David Zeuthen 2012-06-08 13:30:48 -04:00
parent ea826d7fac
commit 3e706ef88b

View File

@ -1609,21 +1609,39 @@ async_init_start_service_by_name_cb (GDBusConnection *connection,
* org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Epiphany2
* was not provided by any .service files
*
* or (see #677718)
*
* org.freedesktop.systemd1.Masked: Unit polkit.service is masked.
*
* This doesn't mean that the name doesn't have an owner, just
* that it's not provided by a .service file. So just proceed to
* invoke GetNameOwner() if dealing with that error.
* that it's not provided by a .service file or can't currently
* be started.
*
* In particular, in both cases, it could be that a service
* owner will actually appear later. So instead of erroring out,
* we just proceed to invoke GetNameOwner() if dealing with the
* kind of errors above.
*/
if (error->domain == G_DBUS_ERROR &&
error->code == G_DBUS_ERROR_SERVICE_UNKNOWN)
if (error->domain == G_DBUS_ERROR && error->code == G_DBUS_ERROR_SERVICE_UNKNOWN)
{
g_error_free (error);
}
else
{
g_prefix_error (&error,
_("Error calling StartServiceByName for %s: "),
data->proxy->priv->name);
goto failed;
gchar *remote_error = g_dbus_error_get_remote_error (error);
if (g_strcmp0 (remote_error, "org.freedesktop.systemd1.Masked") == 0)
{
g_error_free (error);
g_free (remote_error);
}
else
{
g_prefix_error (&error,
_("Error calling StartServiceByName for %s: "),
data->proxy->priv->name);
g_free (remote_error);
goto failed;
}
}
}
else