summaryrefslogtreecommitdiffstats
path: root/adbbu
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-10-01 05:22:13 +0200
committerEthan Yonker <dees_troy@teamw.in>2017-11-28 23:03:41 +0100
commitfefe5915b06a1121d885fba3680dd1b90027fd5d (patch)
tree2370923b618bdbe2592873cd311944628a1d0a62 /adbbu
parentMerge "Support v2 fstab format" into android-8.0 (diff)
downloadandroid_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar.gz
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar.bz2
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar.lz
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar.xz
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.tar.zst
android_bootable_recovery-fefe5915b06a1121d885fba3680dd1b90027fd5d.zip
Diffstat (limited to '')
-rw-r--r--adbbu/libtwadbbu.cpp7
1 files changed, 4 insertions, 3 deletions
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 <vector>
#include <fstream>
#include <sstream>
+#include <assert.h>
#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<std::string> 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;