summaryrefslogtreecommitdiffstats
path: root/install.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-12-23 05:05:33 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-12-23 05:05:33 +0100
commit62227b544593de0dc079012f7436e24241065bd9 (patch)
treee6e5f3752c7618eab6de1a3f85f3a709c6fd2e95 /install.cpp
parentSnap for 5189750 from faf656f3a798495dafe9c60ec219835b7f78cf8b to qt-release (diff)
parentMerge "Add a horizontal line at the end of the graphic menu" am: fc0665c701 am: 095b6858dd (diff)
downloadandroid_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar.gz
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar.bz2
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar.lz
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar.xz
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.tar.zst
android_bootable_recovery-62227b544593de0dc079012f7436e24241065bd9.zip
Diffstat (limited to 'install.cpp')
-rw-r--r--install.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/install.cpp b/install.cpp
index 680937dd1..9d8943f7d 100644
--- a/install.cpp
+++ b/install.cpp
@@ -395,12 +395,8 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
// update attempt.
//
- // Convert the vector to a NULL-terminated char* array suitable for execv.
- const char* chr_args[args.size() + 1];
- chr_args[args.size()] = nullptr;
- for (size_t i = 0; i < args.size(); i++) {
- chr_args[i] = args[i].c_str();
- }
+ // Convert the std::string vector to a NULL-terminated char* vector suitable for execv.
+ auto chr_args = StringVectorToNullTerminatedArray(args);
pid_t pid = fork();
@@ -415,7 +411,7 @@ static int try_update_binary(const std::string& package, ZipArchiveHandle zip, b
if (pid == 0) {
umask(022);
close(pipefd[0]);
- execv(chr_args[0], const_cast<char**>(chr_args));
+ execv(chr_args[0], chr_args.data());
// Bug: 34769056
// We shouldn't use LOG/PLOG in the forked process, since they may cause
// the child process to hang. This deadlock results from an improperly
@@ -595,9 +591,9 @@ static int really_install_package(const std::string& path, bool* wipe_cache, boo
if (needs_mount) {
if (path[0] == '@') {
- ensure_path_mounted(path.substr(1).c_str());
+ ensure_path_mounted(path.substr(1));
} else {
- ensure_path_mounted(path.c_str());
+ ensure_path_mounted(path);
}
}