From: David Herrmann Date: Wed, 11 Mar 2015 15:35:21 +0000 (+0100) Subject: core: fix cgroups-agent match for kdbus X-Git-Tag: v219.0~385 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f5b51ea7fcb0b6380c3ceb4d4f3f22f647c6fd32;p=elogind.git core: fix cgroups-agent match for kdbus On kdbus, we get cgroups-agent messages via the system bus, not the private systemd socket. Therefore, we must install the match properly or we will never receive cgroup notifications. --- diff --git a/src/core/dbus.c b/src/core/dbus.c index e000cccd1..ae259c37d 100644 --- a/src/core/dbus.c +++ b/src/core/dbus.c @@ -852,22 +852,19 @@ static int bus_setup_system(Manager *m, sd_bus *bus) { assert(m); assert(bus); - if (m->running_as == SYSTEMD_SYSTEM) - return 0; - - /* If we are a user instance we get the Released message via - * the system bus */ - r = sd_bus_add_match( - bus, - NULL, - "type='signal'," - "interface='org.freedesktop.systemd1.Agent'," - "member='Released'," - "path='/org/freedesktop/systemd1/agent'", - signal_agent_released, m); - - if (r < 0) - log_warning_errno(r, "Failed to register Released match on system bus: %m"); + /* On kdbus or if we are a user instance we get the Released message via the system bus */ + if (m->running_as == SYSTEMD_USER || m->kdbus_fd >= 0) { + r = sd_bus_add_match( + bus, + NULL, + "type='signal'," + "interface='org.freedesktop.systemd1.Agent'," + "member='Released'," + "path='/org/freedesktop/systemd1/agent'", + signal_agent_released, m); + if (r < 0) + log_warning_errno(r, "Failed to register Released match on system bus: %m"); + } log_debug("Successfully connected to system bus."); return 0;