summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2013-10-09 14:57:12 +0300
committerColin Walters <walters@verbum.org>2013-10-13 23:01:23 -0400
commita0a6408e31fef4618e27fafba416b9858f66a8e3 (patch)
treeff6541db5b5f5e05135e06d00e8f3d2b9e96a06a
parent3990f247652c3bd41e4ea074e6302277eb9c7aa3 (diff)
manager: connect to private bus even if $DBUS_SESSION_BUS_ADDRESS is not set
Because that's exactly the kind of situation where the private bus is necessary.
-rw-r--r--src/core/manager.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/core/manager.c b/src/core/manager.c
index b45a2e11a5..56191bfc7c 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -486,6 +486,7 @@ static int manager_default_environment(Manager *m) {
int manager_new(SystemdRunningAs running_as, bool reexecuting, Manager **_m) {
Manager *m;
int r = -ENOMEM;
+ bool try_bus_connect = false;
assert(_m);
assert(running_as >= 0);
@@ -557,15 +558,18 @@ int manager_new(SystemdRunningAs running_as, bool reexecuting, Manager **_m) {
if (r < 0)
goto fail;
- /* Try to connect to the busses, if possible. */
- if ((running_as == SYSTEMD_USER && getenv("DBUS_SESSION_BUS_ADDRESS")) ||
- running_as == SYSTEMD_SYSTEM) {
- r = bus_init(m, reexecuting || running_as != SYSTEMD_SYSTEM);
- if (r < 0)
- goto fail;
- } else
+ if (running_as == SYSTEMD_SYSTEM)
+ try_bus_connect = reexecuting;
+ else if (getenv("DBUS_SESSION_BUS_ADDRESS"))
+ try_bus_connect = true;
+ else
log_debug("Skipping DBus session bus connection attempt - no DBUS_SESSION_BUS_ADDRESS set...");
+ /* Try to connect to the busses, if possible. */
+ r = bus_init(m, try_bus_connect);
+ if (r < 0)
+ goto fail;
+
m->taint_usr = dir_is_empty("/usr") > 0;
*_m = m;