3 @@ -37,6 +37,8 @@ struct hapd_global {
6 static struct hapd_global global;
7 +static int daemonize = 0;
8 +static char *pid_file = NULL;
11 #ifndef CONFIG_NO_HOSTAPD_LOGGER
12 @@ -143,6 +145,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_driver_init - Preparate driver interface
27 @@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
31 + hapd->setup_complete_cb = hostapd_setup_complete_cb;
33 /* Initialize the driver interface */
34 if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
36 @@ -401,8 +413,6 @@ static void hostapd_global_deinit(const
37 #endif /* CONFIG_NATIVE_WINDOWS */
39 eap_server_unregister_methods();
41 - os_daemonize_terminate(pid_file);
45 @@ -428,18 +438,6 @@ static int hostapd_global_run(struct hap
47 #endif /* EAP_SERVER_TNC */
50 - if (os_daemonize(pid_file)) {
51 - wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
54 - if (eloop_sock_requeue()) {
55 - wpa_printf(MSG_ERROR, "eloop_sock_requeue: %s",
64 @@ -638,8 +636,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;
73 char **bss_config = NULL, **tmp_bss;