Newbie question: dbus_bus_get() and dbus_error_is_set()

Dan Arrhenius dan at keystream.se
Wed Apr 6 04:29:44 PDT 2011


Hi all!
I'm just starting to play with libdbus-1 and have a question about the error parameter to 
dbus_bus_get().

I tried to force an error with the following code:

...
DBusError err;
DBusConnection* connection;

dbus_error_init (&err);
connection = dbus_bus_get ((DBusBusType)42, &err);
if (dbus_error_is_set(&err)) {
	fprintf (stderr, "dbus_bus_get() failed: %s\n", err.message);
	dbus_error_free (&err);
	exit (1);
}
...

An error is printed to stderr by libdbus and dbus_bus_get() returns NULL, but 
dbus_error_is_set() doesn't return true and err.message is NULL.
Is this normal behavior in libdbus, to not use the error parameter for some errors and 
instead return NULL ?

Regards,
Dan


More information about the dbus mailing list