From 523ffa148ce16773c2d9f711edb2c0424411d7ac Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 6 Mar 2020 12:53:00 +0000 Subject: =?UTF-8?q?sharing:=20Don=E2=80=99t=20warn=20about=20starting/stop?= =?UTF-8?q?ping=20services=20which=20don=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This squashes the following warning from the journal: ``` Mar 06 12:37:52 endless gsd-sharing[33186]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit rygel.service not loaded. Mar 06 12:37:52 endless gsd-sharing[33186]: Failed to StopUnit service: GDBus.Error:org.freedesktop.systemd1.NoSuchUnit: Unit gnome-remote-desktop.service not loaded. ``` Signed-off-by: Philip Withnall --- plugins/sharing/gsd-sharing-manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/sharing/gsd-sharing-manager.c b/plugins/sharing/gsd-sharing-manager.c index ab3d83c2..43067ccd 100644 --- a/plugins/sharing/gsd-sharing-manager.c +++ b/plugins/sharing/gsd-sharing-manager.c @@ -114,7 +114,10 @@ handle_unit_cb (GObject *source_object, ret = g_dbus_connection_call_finish (G_DBUS_CONNECTION (source_object), res, &error); if (!ret) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_autofree gchar *remote_error = g_dbus_error_get_remote_error (error); + + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED) && + g_strcmp0 (remote_error, "org.freedesktop.systemd1.NoSuchUnit") != 0) g_warning ("Failed to %s service: %s", operation, error->message); g_error_free (error); return; -- cgit v1.2.1