Merge "adbd: don't abort on EOF on functionfs control fd."

am: 41531df7b0

Change-Id: Id07644b95f53dc14136ed078ecc3cbbf2bfc1ead
This commit is contained in:
Josh Gao 2019-05-13 11:52:45 -07:00 committed by android-build-merger
commit f848fac660

View file

@ -297,9 +297,15 @@ struct UsbFfsConnection : public Connection {
}
struct usb_functionfs_event event;
if (TEMP_FAILURE_RETRY(adb_read(control_fd_.get(), &event, sizeof(event))) !=
sizeof(event)) {
rc = TEMP_FAILURE_RETRY(adb_read(control_fd_.get(), &event, sizeof(event)));
if (rc == -1) {
PLOG(FATAL) << "failed to read functionfs event";
} else if (rc == 0) {
LOG(WARNING) << "hit EOF on functionfs control fd";
break;
} else if (rc != sizeof(event)) {
LOG(FATAL) << "read functionfs event of unexpected size, expected "
<< sizeof(event) << ", got " << rc;
}
LOG(INFO) << "USB event: "