When libgdbus fails to get bus for one of global busses (system, session)
it still returns vaild pointer. It's because global busses are cached in
g_dh[2] which always exist.
This commit changes the get_connection function to return null for all the
checks like following to detect and fail in the case where getting bus was
unsuccessfull (ie. dbus-daemon isn't running in early boot/special targets)
dh = _dbus_handle_get_default_connection();
if (!dh) {
_E("failed to get default connection, bustype:%d", (int)dbus_handle_get_default_bus_type());
...
Change-Id: If85fe8e6cb7a5f95618df8f7f3fefa923e3e271a
if (!dh->conn) {
dh->conn = _get_bus(bus_type);
+ if (!dh->conn) {
+ dbus_handle_unlock(dh);
+ return NULL;
+ }
dh->priv = FALSE;
dh->bus_type = bus_type;
- if (!dh->conn)
- dh = NULL;
}
dbus_handle_unlock(dh);