Question on C code - any programmatic way of setting DBUS_BUS_SESSION address?
simon.mcvittie at collabora.co.uk
Wed Apr 23 04:18:57 PDT 2008
-----BEGIN PGP SIGNED MESSAGE-----
On Wed, 23 Apr 2008 at 08:58:58 +0300, Andrejus Chaliapinas wrote:
> dbus_bus_get (DBusBusType type,
> const char* address,
> DBusError *error)
If you want to connect to a bus at a non-standard address, you shouldn't
be using "the" shared session-bus connection as returned by dbus_bus_get.
dbus_bus_get sets up and returns a shared connection - just because *you*
want to connect to a non-standard address for the session bus doesn't mean
that any other libraries or components in your process want to do the same.
For a bus at a non-standard location, instead of calling dbus_bus_get(), use
dbus_connection_open() (or possibly dbus_connection_open_private()) followed
If you really do want to manipulate the global state of your process
(this is only appropriate if you are writing the program, rather than a
library), manipulate the environment before any D-Bus API is called
(e.g. in main() or in a wrapper script).
-----BEGIN PGP SIGNATURE-----
-----END PGP SIGNATURE-----
More information about the dbus