[systemd-devel] [PATCH] dbus: fix --system handling

Robert Schwebel r.schwebel at pengutronix.de
Fri Oct 15 03:25:17 PDT 2010


We currently only create the private D-Bus server when pid == 1, but
this has also to be done if the user started us with --system.
Otherwhise we get this error:

  systemd-cgroups-agent[164]: Failed to get D-Bus connection:
  Failed to connect to socket /org/freedesktop/systemd1/private: Connection refused

Signed-off-by: Robert Schwebel <r.schwebel at pengutronix.de>
---
 src/dbus.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/dbus.c b/src/dbus.c
index 4365bca..16e6a5f 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -952,7 +952,7 @@ static int bus_init_private(Manager *m) {
                 return 0;
 
         /* We want the private bus only when running as init */
-        if (getpid() != 1)
+        if (m->running_as != MANAGER_SYSTEM)
                 return 0;
 
         if (!(m->private_bus = dbus_server_listen("unix:abstract=/org/freedesktop/systemd1/private", &error))) {
-- 
1.7.1


More information about the systemd-devel mailing list