2013-02-16 14:26:03 +00:00
|
|
|
--- a/hostapd/main.c
|
|
|
|
+++ b/hostapd/main.c
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -37,6 +37,8 @@ struct hapd_global {
|
2014-04-06 12:13:55 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static struct hapd_global global;
|
2013-02-16 14:26:03 +00:00
|
|
|
+static int daemonize = 0;
|
|
|
|
+static char *pid_file = NULL;
|
|
|
|
|
|
|
|
|
2014-04-06 12:13:55 +00:00
|
|
|
#ifndef CONFIG_NO_HOSTAPD_LOGGER
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -143,6 +145,14 @@ static void hostapd_logger_cb(void *ctx,
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
2013-02-16 19:00:34 +00:00
|
|
|
#endif /* CONFIG_NO_HOSTAPD_LOGGER */
|
2013-02-16 14:26:03 +00:00
|
|
|
|
|
|
|
+static void hostapd_setup_complete_cb(void *ctx)
|
|
|
|
+{
|
|
|
|
+ if (daemonize && os_daemonize(pid_file)) {
|
|
|
|
+ perror("daemon");
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ daemonize = 0;
|
|
|
|
+}
|
|
|
|
|
2013-02-16 19:00:34 +00:00
|
|
|
/**
|
2013-11-25 15:43:15 +00:00
|
|
|
* hostapd_driver_init - Preparate driver interface
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -161,6 +171,8 @@ static int hostapd_driver_init(struct ho
|
2013-11-25 15:43:15 +00:00
|
|
|
return -1;
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
|
|
|
|
2013-11-25 15:43:15 +00:00
|
|
|
+ hapd->setup_complete_cb = hostapd_setup_complete_cb;
|
|
|
|
+
|
|
|
|
/* Initialize the driver interface */
|
|
|
|
if (!(b[0] | b[1] | b[2] | b[3] | b[4] | b[5]))
|
|
|
|
b = NULL;
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -382,8 +394,6 @@ static void hostapd_global_deinit(const
|
2013-02-16 14:26:03 +00:00
|
|
|
#endif /* CONFIG_NATIVE_WINDOWS */
|
|
|
|
|
|
|
|
eap_server_unregister_methods();
|
|
|
|
-
|
|
|
|
- os_daemonize_terminate(pid_file);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -409,11 +419,6 @@ static int hostapd_global_run(struct hap
|
2013-02-16 14:26:03 +00:00
|
|
|
}
|
|
|
|
#endif /* EAP_SERVER_TNC */
|
|
|
|
|
|
|
|
- if (daemonize && os_daemonize(pid_file)) {
|
2015-03-26 23:33:47 +00:00
|
|
|
- wpa_printf(MSG_ERROR, "daemon: %s", strerror(errno));
|
2013-02-16 14:26:03 +00:00
|
|
|
- return -1;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
eloop_run();
|
|
|
|
|
|
|
|
return 0;
|
2016-01-28 17:19:13 +00:00
|
|
|
@@ -566,8 +571,7 @@ int main(int argc, char *argv[])
|
2013-02-16 14:26:03 +00:00
|
|
|
struct hapd_interfaces interfaces;
|
|
|
|
int ret = 1;
|
2013-11-25 15:43:15 +00:00
|
|
|
size_t i, j;
|
2013-02-16 14:26:03 +00:00
|
|
|
- int c, debug = 0, daemonize = 0;
|
|
|
|
- char *pid_file = NULL;
|
|
|
|
+ int c, debug = 0;
|
|
|
|
const char *log_file = NULL;
|
|
|
|
const char *entropy_file = NULL;
|
2013-11-25 15:43:15 +00:00
|
|
|
char **bss_config = NULL, **tmp_bss;
|