Do AIDL initialization after daemonizing the process
Supplicant start from command line is failing when -B option used to
daemonize the supplicant process due to process forked for daemonizing
is not able access the AIDL file decriptor.
To avoid this do AIDL initialization after daemonizing the process.
Bug: 270241817
Test: Manual test. See comments in pa/2427759
Change-Id: I7d8c5c7863f9bf5ac95d3bf141a31c01d71609af
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index 3122c58..0f2556c 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -37,12 +37,6 @@
}
#endif /* CONFIG_CTRL_IFACE_DBUS_NEW */
-#ifdef CONFIG_AIDL
- global->aidl = wpas_aidl_init(global);
- if (!global->aidl)
- return -1;
-#endif /* CONFIG_AIDL */
-
return 0;
}
@@ -68,9 +62,17 @@
return -1;
}
+#ifdef CONFIG_AIDL
+ /* AIDL initialization may not be complete at this point.
+ * Initialization is done after daemonizing in order to avoid
+ * issues with the file descriptor.
+ */
+ if (!wpa_s || !wpa_s->global->aidl)
+ return 0;
/* HIDL interface wants to keep track of the P2P mgmt iface. */
if (wpas_aidl_register_interface(wpa_s))
return -1;
+#endif
return 0;
}