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 * org.freedesktop.DBus.Error.ServiceUnknown: The name org.gnome.Epiphany2
* was not provided by any .service files * 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 * 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 * that it's not provided by a .service file or can't currently
* invoke GetNameOwner() if dealing with that error. * 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 && if (error->domain == G_DBUS_ERROR && error->code == G_DBUS_ERROR_SERVICE_UNKNOWN)
error->code == G_DBUS_ERROR_SERVICE_UNKNOWN)
{ {
g_error_free (error); g_error_free (error);
} }
else else
{ {
g_prefix_error (&error, gchar *remote_error = g_dbus_error_get_remote_error (error);
_("Error calling StartServiceByName for %s: "), if (g_strcmp0 (remote_error, "org.freedesktop.systemd1.Masked") == 0)
data->proxy->priv->name); {
goto failed; 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 else