diff options
author | Irfan Sheriff <isheriff@google.com> | 2010-01-27 15:35:28 -0800 |
---|---|---|
committer | Irfan Sheriff <isheriff@google.com> | 2010-01-28 09:39:50 -0800 |
commit | 2631f993753d726c8c6a85ab66a83db79e54f0bb (patch) | |
tree | adfa297addc2d9293b8cf879f511a0e967c9bb6e | |
parent | 392290d659cabc017f3784d332a6ddf6eaf49bc5 (diff) | |
download | hardware_libhardware_legacy-2631f993753d726c8c6a85ab66a83db79e54f0bb.zip hardware_libhardware_legacy-2631f993753d726c8c6a85ab66a83db79e54f0bb.tar.gz hardware_libhardware_legacy-2631f993753d726c8c6a85ab66a83db79e54f0bb.tar.bz2 |
Return failures as strings to monitor
Bug: 2399119
Change-Id: I17bcb86e002cd520f4275f3786cf54c82aaf59b7
-rw-r--r-- | wifi/wifi.c | 11 |
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); */ |