From fefe5915b06a1121d885fba3680dd1b90027fd5d Mon Sep 17 00:00:00 2001 From: Ethan Yonker Date: Sat, 30 Sep 2017 22:22:13 -0500 Subject: FBE for Pixel 2 Includes various minor fixes for building in Android 8 trees with r23+ tag Update FBE extended header in libtar to version 2 and include the entire ext4_encryption_policy structure now after translating the policy. See this post for more details: https://plus.google.com/u/1/+DeesTroy/posts/i33ygUi7tiu Change-Id: I2af981e51f459b17fcd895fb8c2d3f6c8200e24b --- adbbu/libtwadbbu.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'adbbu/libtwadbbu.cpp') diff --git a/adbbu/libtwadbbu.cpp b/adbbu/libtwadbbu.cpp index 0c7f355fc..64e688c37 100644 --- a/adbbu/libtwadbbu.cpp +++ b/adbbu/libtwadbbu.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "twadbstream.h" #include "libtwadbbu.hpp" @@ -50,8 +51,8 @@ bool twadbbu::Check_ADB_Backup_File(std::string fname) { bytes = read(fd, &buf, sizeof(buf)); close(fd); - if (memcpy(&adbbuhdr, buf, sizeof(adbbuhdr)) < 0) { - printf("Unable to memcpy: %s.\n", fname.c_str(), strerror(errno)); + if (memcpy(&adbbuhdr, buf, sizeof(adbbuhdr)) == NULL) { + printf("Unable to memcpy: %s (%s).\n", fname.c_str(), strerror(errno)); return false; } adbbuhdrcrc = adbbuhdr.crc; @@ -77,7 +78,7 @@ std::vector twadbbu::Get_ADB_Backup_Files(std::string fname) { while (1) { std::string cmdstr; int readbytes; - if (readbytes = read(fd, &buf, sizeof(buf)) > 0) { + if ((readbytes = read(fd, &buf, sizeof(buf))) > 0) { memcpy(&structcmd, buf, sizeof(structcmd)); assert(structcmd.type == TWENDADB || structcmd.type == TWIMG || structcmd.type == TWFN); cmdstr = structcmd.type; -- cgit v1.2.3