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 @@ -146,6 +148,14 @@ static void hostapd_logger_cb(void *ctx,
14 #endif /* CONFIG_NO_HOSTAPD_LOGGER */
16 +static void hostapd_setup_complete_cb(void *ctx)
18 + if (daemonize && os_daemonize(pid_file)) {
26 * hostapd_init - Allocate and initialize per-interface data
27 @@ -189,6 +199,7 @@ static struct hostapd_iface * hostapd_in
31 + hapd->setup_complete_cb = hostapd_setup_complete_cb;
35 @@ -425,8 +436,6 @@ static void hostapd_global_deinit(const
36 #endif /* CONFIG_NATIVE_WINDOWS */
38 eap_server_unregister_methods();
40 - os_daemonize_terminate(pid_file);
44 @@ -452,11 +461,6 @@ static int hostapd_global_run(struct hap
46 #endif /* EAP_SERVER_TNC */
48 - if (daemonize && os_daemonize(pid_file)) {
56 @@ -540,8 +544,7 @@ int main(int argc, char *argv[])
57 struct hapd_interfaces interfaces;
60 - int c, debug = 0, daemonize = 0;
61 - char *pid_file = NULL;
63 const char *log_file = NULL;
64 const char *entropy_file = NULL;