Index: wpa_supplicant-0.5.8/Makefile =================================================================== --- wpa_supplicant-0.5.8.orig/Makefile +++ wpa_supplicant-0.5.8/Makefile @@ -744,6 +744,10 @@ ifndef LDO LDO=$(CC) endif +ifdef CONFIG_DEBUG_FILE +CFLAGS += -DCONFIG_DEBUG_FILE +endif + dynamic_eap_methods: $(EAPDYN) wpa_supplicant: .config $(OBJS) Index: wpa_supplicant-0.5.8/common.c =================================================================== --- wpa_supplicant-0.5.8.orig/common.c +++ wpa_supplicant-0.5.8/common.c @@ -354,11 +354,8 @@ int wpa_debug_open_file(void) #ifdef _WIN32 os_snprintf(fname, sizeof(fname), "\\Temp\\wpa_supplicant-log-%d.txt", count++); -#else /* _WIN32 */ - os_snprintf(fname, sizeof(fname), "/tmp/wpa_supplicant-log-%d.txt", - count++); #endif /* _WIN32 */ - out_file = fopen(fname, "w"); + out_file = fopen("/var/log/wpa_supplicant.log", "a"); return out_file == NULL ? -1 : 0; #else /* CONFIG_DEBUG_FILE */ return 0; Index: wpa_supplicant-0.5.8/main.c =================================================================== --- wpa_supplicant-0.5.8.orig/main.c +++ wpa_supplicant-0.5.8/main.c @@ -45,7 +45,12 @@ static void usage(void) "[-p] \\\n" " [-b [-N -i -c [-C] " "[-D] \\\n" - " [-p] [-b] ...]\n" + " [-p] [-b] ...] " +#ifdef CONFIG_DEBUG_FILE + "[-f] \\\n" +#else + "\n" +#endif "\n" "drivers:\n", wpa_supplicant_version, wpa_supplicant_license); @@ -65,6 +70,9 @@ static void usage(void) " -i = interface name\n" " -d = increase debugging verbosity (-dd even more)\n" " -D = driver name\n" +#ifdef CONFIG_DEBUG_FILE + " -f = Log output to /var/log/wpa_supplicant.log\n" +#endif " -g = global ctrl_interface\n" " -K = include keys (passwords, etc.) in debug output\n" " -t = include timestamp in debug messages\n" @@ -143,7 +151,7 @@ int main(int argc, char *argv[]) wpa_supplicant_fd_workaround(); for (;;) { - c = getopt(argc, argv, "b:Bc:C:D:dg:hi:KLNp:P:qtuvwW"); + c = getopt(argc, argv, "b:Bc:C:D:dfg:hi:KLNp:P:qtuvwW"); if (c < 0) break; switch (c) { @@ -172,6 +180,11 @@ int main(int argc, char *argv[]) params.wpa_debug_level--; break; #endif /* CONFIG_NO_STDOUT_DEBUG */ +#ifdef CONFIG_DEBUG_FILE + case 'f': + params.wpa_debug_use_file = 1; + break; +#endif case 'g': params.ctrl_interface = optarg; break;