Patchwork [4/7] wpa-config: Add some debug info for config file error cases.

login
register
mail settings
Submitter Ben Greear
Date July 6, 2012, 4:52 p.m.
Message ID <1341593561-14090-4-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/169504/
State Accepted
Commit 481cac211e6badb2042ba278b8c47bff45439e5b
Headers show

Comments

Ben Greear - July 6, 2012, 4:52 p.m.
From: Ben Greear <greearb@candelatech.com>

It didn't alway spit out useful stuff when reading config failed.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
 wpa_supplicant/config_file.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
Jouni Malinen - Aug. 4, 2012, 5:39 p.m.
On Fri, Jul 06, 2012 at 09:52:38AM -0700, greearb@candelatech.com wrote:
> It didn't alway spit out useful stuff when reading config failed.

Thanks, applied.

Patch

diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 8badc7b..c008a79 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -329,11 +329,16 @@  struct wpa_config * wpa_config_read(const char *name)
 	int cred_id = 0;
 
 	config = wpa_config_alloc_empty(NULL, NULL);
-	if (config == NULL)
+	if (config == NULL) {
+		wpa_printf(MSG_ERROR, "Failed to allocate config file structure.");
 		return NULL;
+	}
+
 	wpa_printf(MSG_DEBUG, "Reading configuration file '%s'", name);
 	f = fopen(name, "r");
 	if (f == NULL) {
+		wpa_printf(MSG_ERROR, "Failed to open config file '%s', error: %s",
+			   name, strerror(errno));
 		os_free(config);
 		return NULL;
 	}
@@ -378,6 +383,8 @@  struct wpa_config * wpa_config_read(const char *name)
 		} else if (os_strncmp(pos, "blob-base64-", 12) == 0) {
 			if (wpa_config_process_blob(config, f, &line, pos + 12)
 			    < 0) {
+				wpa_printf(MSG_ERROR, "Line %d: failed to process "
+					   "blob.", line);
 				errors++;
 				continue;
 			}