summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-12-20 18:44:06 +0100
committerTao Bao <tbao@google.com>2018-12-20 19:46:06 +0100
commit3d69f0df961b8a79d247ca91dc272c60e504b538 (patch)
treec08c10e3acf70606bf61e1d68b582f72f0aa1572 /roots.cpp
parentMerge changes from topic "vintf_object_recovery_mount" (diff)
downloadandroid_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar.gz
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar.bz2
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar.lz
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar.xz
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.tar.zst
android_bootable_recovery-3d69f0df961b8a79d247ca91dc272c60e504b538.zip
Diffstat (limited to 'roots.cpp')
-rw-r--r--roots.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/roots.cpp b/roots.cpp
index e988da0a8..6db0ca519 100644
--- a/roots.cpp
+++ b/roots.cpp
@@ -28,7 +28,6 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
@@ -44,6 +43,7 @@
#include <fs_mgr_dm_linear.h>
#include "otautil/mounts.h"
+#include "otautil/sysutil.h"
static Fstab fstab;
@@ -90,12 +90,8 @@ int ensure_path_unmounted(const std::string& path) {
}
static int exec_cmd(const std::vector<std::string>& args) {
- CHECK_NE(static_cast<size_t>(0), args.size());
-
- std::vector<char*> argv(args.size());
- std::transform(args.cbegin(), args.cend(), argv.begin(),
- [](const std::string& arg) { return const_cast<char*>(arg.c_str()); });
- argv.push_back(nullptr);
+ CHECK(!args.empty());
+ auto argv = StringVectorToNullTerminatedArray(args);
pid_t child;
if ((child = fork()) == 0) {