4 extern int wpa_debug_level;
5 extern int wpa_debug_show_keys;
6 extern int wpa_debug_timestamp;
7 +static int daemonize = 0;
8 +static char *pid_file = NULL;
10 extern struct wpa_driver_ops *wpa_drivers[];
12 @@ -279,6 +281,14 @@ static int hostapd_driver_init(struct ho
16 +static void hostapd_setup_complete_cb(void *ctx)
18 + if (daemonize && os_daemonize(pid_file)) {
25 static struct hostapd_iface *
26 hostapd_interface_init(struct hapd_interfaces *interfaces,
27 @@ -298,6 +308,7 @@ hostapd_interface_init(struct hapd_inter
28 iface->bss[0]->conf->logger_stdout_level--;
31 + iface->bss[0]->setup_complete_cb = hostapd_setup_complete_cb;
32 if (iface->conf->bss[0].iface[0] != 0 ||
33 hostapd_drv_none(iface->bss[0])) {
34 if (hostapd_driver_init(iface) ||
35 @@ -310,7 +321,6 @@ hostapd_interface_init(struct hapd_inter
41 * handle_term - SIGINT and SIGTERM handler to terminate hostapd process
43 @@ -425,8 +435,6 @@ static void hostapd_global_deinit(const
44 #endif /* CONFIG_NATIVE_WINDOWS */
46 eap_server_unregister_methods();
48 - os_daemonize_terminate(pid_file);
52 @@ -452,11 +460,6 @@ static int hostapd_global_run(struct hap
54 #endif /* EAP_SERVER_TNC */
56 - if (daemonize && os_daemonize(pid_file)) {
64 @@ -540,8 +543,7 @@ int main(int argc, char *argv[])
65 struct hapd_interfaces interfaces;
68 - int c, debug = 0, daemonize = 0;
69 - char *pid_file = NULL;
71 const char *log_file = NULL;
72 const char *entropy_file = NULL;