ADB Backup: Fix gzip backup and restore
Change-Id: I92821c7053089d130a5ab73fa36aec486da77bf1
diff --git a/adbbu/adbbumain.cpp b/adbbu/adbbumain.cpp
index 050c9bc..4f5efec 100644
--- a/adbbu/adbbumain.cpp
+++ b/adbbu/adbbumain.cpp
@@ -31,7 +31,8 @@
int main(int argc, char **argv) {
int index;
- int ret = 0, pos = 0;
+ int pos = 0;
+ bool ret = false;
int maxpos = sizeof(TWRPARG + 2);
std::string command;
twrpback tw;
@@ -73,8 +74,9 @@
else if (command.substr(0, sizeof(TWRP_STREAM_ARG) - 1) == TWRP_STREAM_ARG) {
tw.setStreamFileName(argv[3]);
tw.threadStream();
+ ret = true;
}
- if (ret == 0)
+ if (ret)
tw.adblogwrite("Adb backup/restore completed\n");
else
tw.adblogwrite("Adb backup/restore failed\n");
@@ -85,5 +87,8 @@
tw.adblogwrite("Unable to remove TW_ADB_BU_CONTROL: " + str.str());
}
unlink(TW_ADB_TWRP_CONTROL);
- return ret;
+ if (ret)
+ return 0;
+ else
+ return -1;
}