Do AIDL initialization after daemonizing the process
SAP start from command line is failing when -B option used to daemonize
the hostapd 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: Start hostapd both with and without the -B option.
Change-Id: I7db15fe0e92148ae59d7c2d67c3b4fa745431f99
diff --git a/hostapd/main.c b/hostapd/main.c
index 822403f..772ba74 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -445,6 +445,13 @@
}
}
+#ifdef CONFIG_CTRL_IFACE_AIDL
+ if (hostapd_aidl_init(ifaces)) {
+ wpa_printf(MSG_ERROR, "Failed to initialize AIDL interface");
+ return -1;
+ }
+#endif /* CONFIG_CTRL_IFACE_AIDL */
+
eloop_run();
return 0;
@@ -895,12 +902,6 @@
goto out;
}
-#ifdef CONFIG_CTRL_IFACE_AIDL
- if (hostapd_aidl_init(&interfaces)) {
- wpa_printf(MSG_ERROR, "Failed to initialize AIDL interface");
- goto out;
- }
-#endif /* CONFIG_CTRL_IFACE_AIDL */
hostapd_global_ctrl_iface_init(&interfaces);
if (hostapd_global_run(&interfaces, daemonize, pid_file)) {