summaryrefslogtreecommitdiff
path: root/src/core/manager.c
diff options
context:
space:
mode:
authorAuke Kok <auke-jan.h.kok@intel.com>2013-06-20 13:36:33 -0700
committerLennart Poettering <lennart@poettering.net>2013-06-20 23:37:04 +0200
commited002560a1945fb8765c5559c293a19bc9e132d8 (patch)
tree61371b4e231c4f35a16dd9c40211a13fb9ab5afc /src/core/manager.c
parent3d3ee759e682701fce77b6559508e697e9e60fbf (diff)
core: only attempt to connect to a session bus if one likely exists.
Diffstat (limited to 'src/core/manager.c')
-rw-r--r--src/core/manager.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index 5c3a2c72f3..2416dd0f1e 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;