[systemd-devel] [PATCH 4/4] core: don't add a dependency to dbus.socket for the user bus

Giovanni Campagna scampa.giovanni at gmail.com
Thu Dec 26 14:35:13 PST 2013


From: Giovanni Campagna <gcampagna at src.gnome.org>

When running off dbus-daemon, the user bus is not in a well-defined
location, and is sometimes used as the session bus or something
entirely different. In any case, it is safe to assume the bus already
exists.
When running off kdbus, there is no dbus.socket at all.

This fixes running dbus-activated services in a kdbus environment
from the user manager.
---
 src/core/service.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/core/service.c b/src/core/service.c
index 8097e26..c8ad2d1 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1253,7 +1253,8 @@ static int service_load(Unit *u) {
                 if (s->watchdog_usec > 0 && s->notify_access == NOTIFY_NONE)
                         s->notify_access = NOTIFY_MAIN;
 
-                if (s->type == SERVICE_DBUS || s->bus_name) {
+                if ((s->type == SERVICE_DBUS || s->bus_name) &&
+                    UNIT(s)->manager->running_as == SYSTEMD_SYSTEM) {
                         r = unit_add_two_dependencies_by_name(u, UNIT_AFTER, UNIT_REQUIRES, SPECIAL_DBUS_SOCKET, NULL, true);
                         if (r < 0)
                                 return r;
-- 
1.8.4.2



More information about the systemd-devel mailing list