MTP: handle cancel event while copying file
While received canceling event, error code is set but not
returned with correct state
Bug: 65644242
Test: manually copy file with / without cancel under Win10
Test: atest MtpFfsHandleTest
Change-Id: I601599c77bdd7c8615ed63970c8b22b8c5fcc315
diff --git a/media/mtp/MtpFfsHandle.cpp b/media/mtp/MtpFfsHandle.cpp
index f25fc71..ad3c068 100644
--- a/media/mtp/MtpFfsHandle.cpp
+++ b/media/mtp/MtpFfsHandle.cpp
@@ -212,7 +212,6 @@
uint16_t value = setup->wValue;
std::vector<char> buf;
buf.resize(length);
- int ret = 0;
if (!(type & USB_DIR_IN)) {
if (::read(mControl, buf.data(), length) != length) {
@@ -225,8 +224,8 @@
case MTP_REQ_RESET:
case MTP_REQ_CANCEL:
errno = ECANCELED;
- ret = -1;
- break;
+ return -1;
+ // break;
case MTP_REQ_GET_DEVICE_STATUS:
{
if (length < sizeof(struct mtp_device_status) + 4) {