diff options
author | Tao Bao <tbao@google.com> | 2018-12-20 23:36:02 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-12-20 23:36:02 +0100 |
commit | 1b94d3a35bf5c11405ee2fcad9799705680a351e (patch) | |
tree | c08c10e3acf70606bf61e1d68b582f72f0aa1572 /roots.cpp | |
parent | Merge changes from topic "vintf_object_recovery_mount" (diff) | |
parent | Merge "Clean up the arg setup for exec(3)." (diff) | |
download | android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar.gz android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar.bz2 android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar.lz android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar.xz android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.tar.zst android_bootable_recovery-1b94d3a35bf5c11405ee2fcad9799705680a351e.zip |
Diffstat (limited to '')
-rw-r--r-- | roots.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
@@ -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) { |