From 4a2a1914a2bbe97ed55aa7b0e000aa4c6c8cb1ca Mon Sep 17 00:00:00 2001 From: bigbiff bigbiff Date: Sat, 3 Jun 2017 10:55:46 -0400 Subject: adbbackup: write smaller reads less than 512 bytes This will allow the gzip compression header to be written properly to the adb stream. Thanks to nkk71 for finding the issue. Change-Id: I3d88c5f575ca3fac904d8279f1f246994be2b02f --- adbbu/twrpback.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/adbbu/twrpback.cpp b/adbbu/twrpback.cpp index d9b973bcc..1c98a1b5c 100644 --- a/adbbu/twrpback.cpp +++ b/adbbu/twrpback.cpp @@ -330,7 +330,7 @@ int twrpback::backup(std::string command) { //to the adb stream. //If the stream is compressed, we need to always write the data. if (writedata || compressed) { - while ((bytes = read(adb_read_fd, &result, sizeof(result))) == MAX_ADB_READ) { + while ((bytes = read(adb_read_fd, &result, sizeof(result))) > 0) { if (firstDataPacket) { struct AdbBackupControlType data_block; -- cgit v1.2.3