Patchwork [2/2] Better wpa_cli error messages when connect fails.

login
register
mail settings
Submitter Ben Greear
Date April 4, 2012, 5:15 a.m.
Message ID <1333516509-28394-2-git-send-email-greearb@candelatech.com>
Download mbox | patch
Permalink /patch/150599/
State Accepted
Commit 5a49459ee8efd685c8da923afa7da791d9319ee6
Headers show

Comments

Ben Greear - April 4, 2012, 5:15 a.m.
From: Ben Greear <greearb@candelatech.com>

Signed-hostap: Ben Greear <greearb@candelatech.com>
---
:100644 100644 21a4483... 6dc8b71... M	wpa_supplicant/wpa_cli.c
 wpa_supplicant/wpa_cli.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
Jouni Malinen - April 6, 2012, 9:17 a.m.
On Tue, Apr 03, 2012 at 10:15:09PM -0700, greearb@candelatech.com wrote:
> :100644 100644 21a4483... 6dc8b71... M	wpa_supplicant/wpa_cli.c
>  wpa_supplicant/wpa_cli.c |   12 ++++++------

Thanks, applied.

Patch

diff --git a/wpa_supplicant/wpa_cli.c b/wpa_supplicant/wpa_cli.c
index 21a4483..6dc8b71 100644
--- a/wpa_supplicant/wpa_cli.c
+++ b/wpa_supplicant/wpa_cli.c
@@ -3807,8 +3807,8 @@  int main(int argc, char *argv[])
 		ctrl_conn = wpa_ctrl_open(global);
 #endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
 		if (ctrl_conn == NULL) {
-			perror("Failed to connect to wpa_supplicant - "
-			       "wpa_ctrl_open");
+			fprintf(stderr, "Failed to connect to wpa_supplicant global interface: %s  error: %s\n",
+				global, strerror(errno));
 			return -1;
 		}
 	}
@@ -3830,8 +3830,8 @@  int main(int argc, char *argv[])
 			}
 
 			if (!warning_displayed) {
-				printf("Could not connect to wpa_supplicant - "
-				       "re-trying\n");
+				printf("Could not connect to wpa_supplicant: %s - "
+				       "re-trying\n", ctrl_ifname);
 				warning_displayed = 1;
 			}
 			os_sleep(1, 0);
@@ -3840,8 +3840,8 @@  int main(int argc, char *argv[])
 	} else {
 		if (!global &&
 		    wpa_cli_open_connection(ctrl_ifname, 0) < 0) {
-			perror("Failed to connect to wpa_supplicant - "
-			       "wpa_ctrl_open");
+			fprintf(stderr, "Warning: failed to connect to non-global ctrl_ifname: %s  error: %s\n",
+			       ctrl_ifname, strerror(errno));
 			return -1;
 		}