libgdbus: Return null when dbus connection fails 12/252212/2 accepted/tizen/unified/20210129.002321 submit/tizen/20210127.032903
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Mon, 25 Jan 2021 16:57:49 +0000 (17:57 +0100)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Tue, 26 Jan 2021 12:13:13 +0000 (13:13 +0100)
commite5f7bf6a01844c6f0cee95fccf00205b070e822b
treea5a3cf11703169b148053940d69d4c11cbe26aae
parent4692efb77264357ce5549a3b0dc6912b8b211a04
libgdbus: Return null when dbus connection fails

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
src/libgdbus/dbus-system.c