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); */