diff options
author | sam <sam@FreeBSD.org> | 2008-03-24 19:46:53 +0000 |
---|---|---|
committer | sam <sam@FreeBSD.org> | 2008-03-24 19:46:53 +0000 |
commit | 153f9c1cd9a5b749f57e28682fadb39c781e1e5d (patch) | |
tree | f77bae77287d18eaa89acc25e38b5acccca132fe /contrib/wpa_supplicant/common.c | |
parent | 35aef052ff21baa52c4cec68b512986c21f70a48 (diff) | |
download | FreeBSD-src-153f9c1cd9a5b749f57e28682fadb39c781e1e5d.zip FreeBSD-src-153f9c1cd9a5b749f57e28682fadb39c781e1e5d.tar.gz |
Import of WPA supplicant 0.5.10
Diffstat (limited to 'contrib/wpa_supplicant/common.c')
-rw-r--r-- | contrib/wpa_supplicant/common.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/contrib/wpa_supplicant/common.c b/contrib/wpa_supplicant/common.c index c8d6f13..f226c68 100644 --- a/contrib/wpa_supplicant/common.c +++ b/contrib/wpa_supplicant/common.c @@ -20,7 +20,6 @@ #ifdef CONFIG_DEBUG_FILE static FILE *out_file = NULL; #endif /* CONFIG_DEBUG_FILE */ -int wpa_debug_use_file = 0; int wpa_debug_level = MSG_INFO; int wpa_debug_show_keys = 0; int wpa_debug_timestamp = 0; @@ -344,32 +343,29 @@ void wpa_hexdump_ascii_key(int level, const char *title, const u8 *buf, } -int wpa_debug_open_file(void) +int wpa_debug_open_file(const char *path) { #ifdef CONFIG_DEBUG_FILE - static int count = 0; - char fname[64]; - if (!wpa_debug_use_file) + if (!path) return 0; -#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++); + out_file = fopen(path, "a"); + if (out_file == NULL) { + wpa_printf(MSG_ERROR, "wpa_debug_open_file: Failed to open " + "output file, using standard output"); + return -1; + } +#ifndef _WIN32 + setvbuf(out_file, NULL, _IOLBF, 0); #endif /* _WIN32 */ - out_file = fopen(fname, "w"); - return out_file == NULL ? -1 : 0; -#else /* CONFIG_DEBUG_FILE */ - return 0; #endif /* CONFIG_DEBUG_FILE */ + return 0; } void wpa_debug_close_file(void) { #ifdef CONFIG_DEBUG_FILE - if (!wpa_debug_use_file) + if (!out_file) return; fclose(out_file); out_file = NULL; |