eldbus: Call dbus_bus_register() for TYPE_ADDRESS connections

From D-Bus documentation:

http://dbus.freedesktop.org/doc/api/html/group__DBusBus.html

dbus_bus_register():

    If you open a bus connection with dbus_connection_open() or
    dbus_connection_open_private() you will have to dbus_bus_register()
    yourself, or make the appropriate registration method calls yourself.

Signed-off-by: Eduardo Lima (Etrunko) <eduardo.lima@intel.com>
This commit is contained in:
Eduardo Lima (Etrunko) 2013-06-27 17:24:46 -03:00
parent 6f255a7ccc
commit f6295c5828
1 changed files with 10 additions and 1 deletions

View File

@ -989,13 +989,22 @@ _connection_get(Eldbus_Connection_Type type, const char *address)
else
conn->dbus_conn = dbus_bus_get_private(type - 1, &err);
if (dbus_error_is_set(&err))
if (!conn->dbus_conn || dbus_error_is_set(&err))
{
free(conn);
ERR("Error connecting to bus: %s", err.message);
return NULL;
}
if (type == ELDBUS_CONNECTION_TYPE_ADDRESS &&
!dbus_bus_register(conn->dbus_conn, &err))
{
dbus_connection_close(conn->dbus_conn);
free(conn);
ERR("Error registering with bus: %s", err.message);
return NULL;
}
eldbus_connection_setup(conn);
conn->type = type;
conn->refcount = 1;