summaryrefslogtreecommitdiffstats
path: root/otautil/sysutil.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-18 00:14:50 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-07-18 00:14:50 +0200
commit6e46cff9b27df699a1f78442606cbd09aed53461 (patch)
tree5bf35c6deefe6bcaeca33b371719f570a0b1147d /otautil/sysutil.cpp
parentMerge "applypatch: Consolidate CacheSizeCheck() and MakeFreeSpaceOnCache()." am: 624b6b6cd5 am: 603b7ed470 (diff)
parentMerge "Fix the arguments passed to getopt_long(3)." am: 29932e7bcc (diff)
downloadandroid_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.gz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.bz2
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.lz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.xz
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.tar.zst
android_bootable_recovery-6e46cff9b27df699a1f78442606cbd09aed53461.zip
Diffstat (limited to 'otautil/sysutil.cpp')
-rw-r--r--otautil/sysutil.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/otautil/sysutil.cpp b/otautil/sysutil.cpp
index ab1513088..d8969a0bb 100644
--- a/otautil/sysutil.cpp
+++ b/otautil/sysutil.cpp
@@ -23,6 +23,7 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <algorithm>
#include <string>
#include <vector>
@@ -211,3 +212,11 @@ bool reboot(const std::string& command) {
}
return android::base::SetProperty(ANDROID_RB_PROPERTY, cmd);
}
+
+std::vector<char*> StringVectorToNullTerminatedArray(const std::vector<std::string>& args) {
+ std::vector<char*> result(args.size());
+ std::transform(args.cbegin(), args.cend(), result.begin(),
+ [](const std::string& arg) { return const_cast<char*>(arg.c_str()); });
+ result.push_back(nullptr);
+ return result;
+}