aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'hostapd/main.c')
-rw-r--r--hostapd/main.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/hostapd/main.c b/hostapd/main.c
index 9c532d4..45836df 100644
--- a/hostapd/main.c
+++ b/hostapd/main.c
@@ -467,6 +467,9 @@ static void usage(void)
" -B run daemon in the background\n"
" -P PID file\n"
" -K include key data in debug messages\n"
+#ifdef CONFIG_DEBUG_FILE
+ " -f log output to debug file instead of stdout\n"
+#endif /* CONFIG_DEBUG_FILE */
" -t include timestamps in some debug messages\n"
" -v show hostapd version\n");
@@ -481,12 +484,13 @@ int main(int argc, char *argv[])
size_t i;
int c, debug = 0, daemonize = 0;
char *pid_file = NULL;
+ const char *log_file = NULL;
if (os_program_init())
return -1;
for (;;) {
- c = getopt(argc, argv, "BdhKP:tv");
+ c = getopt(argc, argv, "Bdf:hKP:tv");
if (c < 0)
break;
switch (c) {
@@ -501,6 +505,9 @@ int main(int argc, char *argv[])
case 'B':
daemonize++;
break;
+ case 'f':
+ log_file = optarg;
+ break;
case 'K':
wpa_debug_show_keys++;
break;
@@ -525,6 +532,9 @@ int main(int argc, char *argv[])
if (optind == argc)
usage();
+ if (log_file)
+ wpa_debug_open_file(log_file);
+
interfaces.count = argc - optind;
interfaces.iface = os_malloc(interfaces.count *
sizeof(struct hostapd_iface *));
@@ -559,6 +569,9 @@ int main(int argc, char *argv[])
hostapd_global_deinit(pid_file);
os_free(pid_file);
+ if (log_file)
+ wpa_debug_close_file();
+
os_program_deinit();
return ret;