summaryrefslogtreecommitdiffstats
path: root/twinstall.cpp
diff options
context:
space:
mode:
authorEthan Yonker <dees_troy@teamw.in>2017-12-14 21:43:59 +0100
committerEthan Yonker <dees_troy@teamw.in>2017-12-15 19:48:49 +0100
commitecbd3e8ba9d84eca9d4fdea9b24717364f81a668 (patch)
treed3027aeb161e13673416d1684e6f4e47c85241d0 /twinstall.cpp
parentFix build error in AOSP 8.1.0 r1 tree (diff)
parentMerge cherrypicks of [3156476, 3155698, 3156194, 3156639, 3156018, 3156477, 3156098, 3156099, 3156100, 3156101, 3156102, 3158393, 3155699, 3155700, 3156195, 3156196, 3156019, 3156020, 3158394] into oc-mr1-release (diff)
downloadandroid_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.gz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.bz2
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.lz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.xz
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.tar.zst
android_bootable_recovery-ecbd3e8ba9d84eca9d4fdea9b24717364f81a668.zip
Diffstat (limited to 'twinstall.cpp')
-rw-r--r--twinstall.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/twinstall.cpp b/twinstall.cpp
index ab715291a..7351e6326 100644
--- a/twinstall.cpp
+++ b/twinstall.cpp
@@ -363,7 +363,11 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
DataManager::SetProgress(0);
MemMapping map;
+#ifdef USE_MINZIP
if (sysMapFile(path, &map) != 0) {
+#else
+ if (!map.MapFile(path)) {
+#endif
gui_msg(Msg(msg::kError, "fail_sysmap=Failed to map file '{1}'")(path));
return -1;
}
@@ -377,6 +381,9 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
if (!load_keys("/res/keys", loadedKeys)) {
LOGINFO("Failed to load keys");
gui_err("verify_zip_fail=Zip signature verification failed!");
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
return -1;
}
ret_val = verify_file(map.addr, map.length, loadedKeys, std::bind(&DataManager::SetProgress, std::placeholders::_1));
@@ -384,7 +391,9 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
if (ret_val != VERIFY_SUCCESS) {
LOGINFO("Zip signature verification failed: %i\n", ret_val);
gui_err("verify_zip_fail=Zip signature verification failed!");
+#ifdef USE_MINZIP
sysReleaseMap(&map);
+#endif
return -1;
} else {
gui_msg("verify_zip_done=Zip signature verified successfully.");
@@ -393,7 +402,9 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
ZipWrap Zip;
if (!Zip.Open(path, &map)) {
gui_err("zip_corrupt=Zip file is corrupt!");
- sysReleaseMap(&map);
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
return INSTALL_CORRUPT;
}
@@ -404,8 +415,10 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
// Additionally verify the compatibility of the package.
if (!verify_package_compatibility(&Zip)) {
gui_err("zip_compatible_err=Zip Treble compatibility error!");
- sysReleaseMap(&map);
Zip.Close();
+#ifdef USE_MINZIP
+ sysReleaseMap(&map);
+#endif
ret_val = INSTALL_CORRUPT;
} else {
ret_val = Prepare_Update_Binary(path, &Zip, wipe_cache);
@@ -433,6 +446,8 @@ int TWinstall_zip(const char* path, int* wipe_cache) {
} else {
LOGINFO("Install took %i second(s).\n", total_time);
}
+#ifdef USE_MINZIP
sysReleaseMap(&map);
+#endif
return ret_val;
}