system/core
Revision | 82ebfca5cdaefaeaae95a5fe641bdf594b6ac2cd (tree) |
---|---|
Zeit | 2019-05-14 07:21:59 |
Autor | TreeHugger Robot <treehugger-gerrit@goog...> |
Commiter | Android (Google) Code Review |
Merge "adbd: don't abort on EOF on functionfs control fd." into qt-dev
@@ -295,9 +295,15 @@ struct UsbFfsConnection : public Connection { | ||
295 | 295 | } |
296 | 296 | |
297 | 297 | struct usb_functionfs_event event; |
298 | - if (TEMP_FAILURE_RETRY(adb_read(control_fd_.get(), &event, sizeof(event))) != | |
299 | - sizeof(event)) { | |
298 | + rc = TEMP_FAILURE_RETRY(adb_read(control_fd_.get(), &event, sizeof(event))); | |
299 | + if (rc == -1) { | |
300 | 300 | PLOG(FATAL) << "failed to read functionfs event"; |
301 | + } else if (rc == 0) { | |
302 | + LOG(WARNING) << "hit EOF on functionfs control fd"; | |
303 | + break; | |
304 | + } else if (rc != sizeof(event)) { | |
305 | + LOG(FATAL) << "read functionfs event of unexpected size, expected " | |
306 | + << sizeof(event) << ", got " << rc; | |
301 | 307 | } |
302 | 308 | |
303 | 309 | LOG(INFO) << "USB event: " |