libiwinfo: fail after 5 tries when there's no response from wpa_supplicant

This commit is contained in:
Jo-Philipp Wich 2011-01-18 15:28:45 +00:00
parent 5858bd3c13
commit bf41f6ecfb

View file

@ -356,6 +356,7 @@ static inline int nl80211_wpactl_recv(int sock, char *buf, int blen)
static char * nl80211_wpactl_info(const char *ifname, const char *cmd, static char * nl80211_wpactl_info(const char *ifname, const char *cmd,
const char *event) const char *event)
{ {
int numtry = 0;
int sock = -1; int sock = -1;
char *rv = NULL; char *rv = NULL;
size_t remote_length, local_length; size_t remote_length, local_length;
@ -395,7 +396,7 @@ static char * nl80211_wpactl_info(const char *ifname, const char *cmd,
send(sock, cmd, strlen(cmd), 0); send(sock, cmd, strlen(cmd), 0);
while( 1 ) while( numtry++ < 5 )
{ {
if( nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0 ) if( nl80211_wpactl_recv(sock, buffer, sizeof(buffer)) <= 0 )
{ {