Better wpa_cli error messages when connect fails

Signed-hostap: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2012-04-06 12:15:30 +03:00 committed by Jouni Malinen
parent 9d05374796
commit 5a49459ee8

View file

@ -3807,8 +3807,9 @@ int main(int argc, char *argv[])
ctrl_conn = wpa_ctrl_open(global); ctrl_conn = wpa_ctrl_open(global);
#endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */ #endif /* CONFIG_CTRL_IFACE_NAMED_PIPE */
if (ctrl_conn == NULL) { if (ctrl_conn == NULL) {
perror("Failed to connect to wpa_supplicant - " fprintf(stderr, "Failed to connect to wpa_supplicant "
"wpa_ctrl_open"); "global interface: %s error: %s\n",
global, strerror(errno));
return -1; return -1;
} }
} }
@ -3830,8 +3831,8 @@ int main(int argc, char *argv[])
} }
if (!warning_displayed) { if (!warning_displayed) {
printf("Could not connect to wpa_supplicant - " printf("Could not connect to wpa_supplicant: "
"re-trying\n"); "%s - re-trying\n", ctrl_ifname);
warning_displayed = 1; warning_displayed = 1;
} }
os_sleep(1, 0); os_sleep(1, 0);
@ -3840,8 +3841,9 @@ int main(int argc, char *argv[])
} else { } else {
if (!global && if (!global &&
wpa_cli_open_connection(ctrl_ifname, 0) < 0) { wpa_cli_open_connection(ctrl_ifname, 0) < 0) {
perror("Failed to connect to wpa_supplicant - " fprintf(stderr, "Failed to connect to non-global "
"wpa_ctrl_open"); "ctrl_ifname: %s error: %s\n",
ctrl_ifname, strerror(errno));
return -1; return -1;
} }