fastbootd: Fix USB transport data is repeated every 256K

When Write() is called on data > 256K, the written data
repeats every 256K because of the buggy line in this change.

Test: fastboot fetch vendor_boot.img
Fixes: 180654366

Change-Id: I33b129de27000d3f32f284469998daf540d4f856
This commit is contained in:
Yifan Hong 2021-02-22 14:30:35 -08:00
parent d42b34cb65
commit 5f23388c7a

View file

@ -283,7 +283,7 @@ ssize_t ClientUsbTransport::Write(const void* data, size_t len) {
size_t bytes_written_total = 0;
while (bytes_written_total < len) {
auto bytes_to_write = std::min(len - bytes_written_total, kFbFfsNumBufs * kFbFfsBufSize);
auto bytes_written_now = handle_->write(handle_.get(), data, bytes_to_write);
auto bytes_written_now = handle_->write(handle_.get(), char_data, bytes_to_write);
if (bytes_written_now < 0) {
return bytes_written_total == 0 ? -1 : bytes_written_total;
}