On Unix platforms, try $XDG_RUNTIME_DIR/bus before default address
authorSimon McVittie <simon.mcvittie@collabora.co.uk>
Mon, 9 Feb 2015 17:44:53 +0000 (17:44 +0000)
committerSimon McVittie <simon.mcvittie@collabora.co.uk>
Tue, 24 Feb 2015 11:15:25 +0000 (11:15 +0000)
commitb9de1f5ef01874834aab4519cc58a29b866ca94a
tree955969627513bf27964e8f13b3baa79b9ff9cedb
parent326d342345908e12e71133a9c9e3a96cfbfa4493
On Unix platforms, try $XDG_RUNTIME_DIR/bus before default address

This is safe to do even on systems where there is a per-login-session
bus: the $XDG_RUNTIME_DIR/bus would just not exist there. This means
that OS builders can enable a per-user-session bus by merely providing
configuration to start it, without needing to rebuild the client library.

Based on a patch by Colin Walters, with these changes:

- factor out the actual XDG_RUNTIME_DIR bit into a function
- set error correctly on OOM
- do not try to use an XDG_RUNTIME_DIR/bus that belongs to a
  different uid or is not a socket
- escape the path if it contains inconvenient characters
- coding style adjustments

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=61301
Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk>
dbus/dbus-sysdeps-unix.c
dbus/dbus-sysdeps-unix.h