summaryrefslogtreecommitdiffstats
path: root/roots.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-12-20 23:10:07 +0100
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-12-20 23:10:07 +0100
commitf0c03e62a2fe855ac15a04265d6dc3337c63e360 (patch)
treec08c10e3acf70606bf61e1d68b582f72f0aa1572 /roots.cpp
parentMerge changes from topic "vintf_object_recovery_mount" (diff)
parentClean up the arg setup for exec(3). (diff)
downloadandroid_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar.gz
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar.bz2
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar.lz
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar.xz
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.tar.zst
android_bootable_recovery-f0c03e62a2fe855ac15a04265d6dc3337c63e360.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) {