[systemd-devel] [PATCH] Only attempt to connect to a session bus if one likely exists.
Lennart Poettering
lennart at poettering.net
Thu Jun 20 14:37:33 PDT 2013
On Thu, 20.06.13 13:36, Auke Kok (auke-jan.h.kok at intel.com) wrote:
Applied, with some coding style fixes.
> Cc: chengwei.yang at intel.com
> Cc: lennart at poettering.net
> ---
> src/core/manager.c | 11 ++++++++---
> 1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/src/core/manager.c b/src/core/manager.c
> index f16621a..592f332 100644
> --- a/src/core/manager.c
> +++ b/src/core/manager.c
> @@ -509,9 +509,14 @@ 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;
>
Lennart
--
Lennart Poettering - Red Hat, Inc.
More information about the systemd-devel
mailing list