mirror of
https://github.com/systemd/systemd
synced 2024-07-21 10:17:21 +00:00
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.
This commit is contained in:
parent
3990f24765
commit
a0a6408e31
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue