mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 13:02:44 +01:00
main: don't crash if DBus is not running
dbus_init() currently does not check for the g_dbus object being properly initialized and this leads to crashes when dbus is not yet running. Ensure g_dbus is properly initialized and return false otherwise. In this case the caller can understand that something went wrong and stop the initialization procedure. Program received signal SIGSEGV, Segmentation fault. 0x00005555555bc089 in l_dbus_add_service_watch (dbus=0x0, name=0x5555555e5b0a "org.ofono", connect_func=0x5555555aa81e <ofono_found>, disconnect_func=0x5555555aa8e6 <ofono_disappeared>, user_data=0x0, destroy=0x0) at ell/dbus.c:1621 1621 if (!dbus->name_cache) (gdb) bt name=0x5555555e5b0a "org.ofono", connect_func=0x5555555aa81e <ofono_found>, disconnect_func=0x5555555aa8e6 <ofono_disappeared>, user_data=0x0, destroy=0x0) at ell/dbus.c:1621 user_data=0x0) at ell/plugin.c:115 function=0x5555555b40fd <plugin_start>, user_data=0x0) at ell/queue.c:441 version=0x0) at ell/plugin.c:201 src/plugin.c:82 src/main.c:417
This commit is contained in:
parent
8112806aca
commit
1de8d18883
@ -214,6 +214,8 @@ struct l_dbus *dbus_get_bus(void)
|
||||
bool dbus_init(bool enable_debug)
|
||||
{
|
||||
g_dbus = l_dbus_new_default(L_DBUS_SYSTEM_BUS);
|
||||
if (!g_dbus)
|
||||
return false;
|
||||
|
||||
if (enable_debug)
|
||||
l_dbus_set_debug(g_dbus, do_debug, "[DBUS] ", NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user