Merge "adbd: don't spin if file sync read fails." am: 32d2eae8b9 am: 4dc1892491
am: 43898a6add
Change-Id: Icc7d13bc5e7ff2aaf63f95f046734fb77db6d72e
diff --git a/adb/file_sync_service.cpp b/adb/file_sync_service.cpp
index 2acf661..3448ee0 100644
--- a/adb/file_sync_service.cpp
+++ b/adb/file_sync_service.cpp
@@ -283,25 +283,25 @@
// reading and throwing away ID_DATA packets until the other side notices
// that we've reported an error.
while (true) {
- if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) goto fail;
+ if (!ReadFdExactly(s, &msg.data, sizeof(msg.data))) break;
if (msg.data.id == ID_DONE) {
- goto abort;
+ break;
} else if (msg.data.id != ID_DATA) {
char id[5];
memcpy(id, &msg.data.id, sizeof(msg.data.id));
id[4] = '\0';
D("handle_send_fail received unexpected id '%s' during failure", id);
- goto abort;
+ break;
}
if (msg.data.size > buffer.size()) {
D("handle_send_fail received oversized packet of length '%u' during failure",
msg.data.size);
- goto abort;
+ break;
}
- if (!ReadFdExactly(s, &buffer[0], msg.data.size)) goto abort;
+ if (!ReadFdExactly(s, &buffer[0], msg.data.size)) break;
}
abort: