summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--wifi/wifi.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/wifi/wifi.c b/wifi/wifi.c
index 8719cac..e6444f3 100644
--- a/wifi/wifi.c
+++ b/wifi/wifi.c
@@ -427,13 +427,18 @@ int wifi_wait_for_event(char *buf, size_t buflen)
struct timeval tval;
struct timeval *tptr;
- if (monitor_conn == NULL)
- return 0;
+ if (monitor_conn == NULL) {
+ strncpy(buf, WPA_EVENT_TERMINATING " - connection closed", buflen-1);
+ buf[buflen-1] = '\0';
+ return strlen(buf);
+ }
result = wpa_ctrl_recv(monitor_conn, buf, &nread);
if (result < 0) {
LOGD("wpa_ctrl_recv failed: %s\n", strerror(errno));
- return -1;
+ strncpy(buf, WPA_EVENT_TERMINATING " - recv error", buflen-1);
+ buf[buflen-1] = '\0';
+ return strlen(buf);
}
buf[nread] = '\0';
/* LOGD("wait_for_event: result=%d nread=%d string=\"%s\"\n", result, nread, buf); */