adbd: don't spin if file sync read fails.
Bug: http://b/64508974
Bug: 64709603 (presubmit balking at the line above)
Test: mma
Change-Id: Ifba6a9dea3138b6d2a62c91cc0532f63986c048a
(cherry picked from commit 1d6c01b53d)
This commit is contained in:
parent
15e5bd4e2b
commit
a2f1335819
1 changed files with 5 additions and 5 deletions
|
|
@ -283,25 +283,25 @@ fail:
|
||||||
// reading and throwing away ID_DATA packets until the other side notices
|
// reading and throwing away ID_DATA packets until the other side notices
|
||||||
// that we've reported an error.
|
// that we've reported an error.
|
||||||
while (true) {
|
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) {
|
if (msg.data.id == ID_DONE) {
|
||||||
goto abort;
|
break;
|
||||||
} else if (msg.data.id != ID_DATA) {
|
} else if (msg.data.id != ID_DATA) {
|
||||||
char id[5];
|
char id[5];
|
||||||
memcpy(id, &msg.data.id, sizeof(msg.data.id));
|
memcpy(id, &msg.data.id, sizeof(msg.data.id));
|
||||||
id[4] = '\0';
|
id[4] = '\0';
|
||||||
D("handle_send_fail received unexpected id '%s' during failure", id);
|
D("handle_send_fail received unexpected id '%s' during failure", id);
|
||||||
goto abort;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg.data.size > buffer.size()) {
|
if (msg.data.size > buffer.size()) {
|
||||||
D("handle_send_fail received oversized packet of length '%u' during failure",
|
D("handle_send_fail received oversized packet of length '%u' during failure",
|
||||||
msg.data.size);
|
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:
|
abort:
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue