summaryrefslogtreecommitdiffstats
path: root/updater/install.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2019-08-01 01:33:59 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-08-01 01:33:59 +0200
commit112acdc04364477a5a9ece353191f70efecf76f3 (patch)
tree30f61107f681cfeebef5e9837e04d5e9e717661e /updater/install.cpp
parentMerge "Create a new function to return the help message for menu" am: 5d9f963e4e (diff)
parentMerge "Simulator: add the argument to keep the updated images" (diff)
downloadandroid_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar.gz
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar.bz2
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar.lz
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar.xz
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.tar.zst
android_bootable_recovery-112acdc04364477a5a9ece353191f70efecf76f3.zip
Diffstat (limited to '')
-rw-r--r--updater/install.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/updater/install.cpp b/updater/install.cpp
index c82351ec4..be0ceb06c 100644
--- a/updater/install.cpp
+++ b/updater/install.cpp
@@ -113,7 +113,7 @@ Value* PackageExtractFileFn(const char* name, State* state,
argv.size());
}
const std::string& zip_path = args[0];
- const std::string& dest_path = args[1];
+ std::string dest_path = args[1];
ZipArchiveHandle za = state->updater->GetPackageHandle();
ZipEntry entry;
@@ -122,6 +122,13 @@ Value* PackageExtractFileFn(const char* name, State* state,
return StringValue("");
}
+ // Update the destination of package_extract_file if it's a block device. During simulation the
+ // destination will map to a fake file.
+ if (std::string block_device_name = state->updater->FindBlockDeviceName(dest_path);
+ !block_device_name.empty()) {
+ dest_path = block_device_name;
+ }
+
android::base::unique_fd fd(TEMP_FAILURE_RETRY(
open(dest_path.c_str(), O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)));
if (fd == -1) {