[systemd-commits] src/core

Lennart Poettering lennart at kemper.freedesktop.org
Thu Jun 20 14:37:22 PDT 2013


 src/core/manager.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit ed002560a1945fb8765c5559c293a19bc9e132d8
Author: Auke Kok <auke-jan.h.kok at intel.com>
Date:   Thu Jun 20 13:36:33 2013 -0700

    core: only attempt to connect to a session bus if one likely exists.

diff --git a/src/core/manager.c b/src/core/manager.c
index 5c3a2c7..2416dd0 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -509,9 +509,13 @@ int manager_new(SystemdRunningAs running_as, Manager **_m) {
                 goto fail;
 
         /* Try to connect to the busses, if possible. */
-        r = bus_init(m, running_as != SYSTEMD_SYSTEM);
-        if (r < 0)
-                goto fail;
+        if ((running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")) ||
+            running_as == SYSTEMD_SYSTEM) {
+                r = bus_init(m, running_as != SYSTEMD_SYSTEM);
+                if (r < 0)
+                        goto fail;
+        } else
+                log_debug("Skipping DBus session bus connection attempt - no DBUS_SESSION_BUS_ADDRESS set...");
 
         m->taint_usr = dir_is_empty("/usr") > 0;
 



More information about the systemd-commits mailing list