diff options
author | Tao Bao <tbao@google.com> | 2018-07-17 23:09:03 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-07-17 23:09:03 +0200 |
commit | 29932e7bcc2865494e4cf03248381475687d227b (patch) | |
tree | fa668d92873b1f1d1df22bb992610ea53a69ed49 /recovery_main.cpp | |
parent | Merge "applypatch: Consolidate CacheSizeCheck() and MakeFreeSpaceOnCache()." (diff) | |
parent | Fix the arguments passed to getopt_long(3). (diff) | |
download | android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar.gz android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar.bz2 android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar.lz android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar.xz android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.tar.zst android_bootable_recovery-29932e7bcc2865494e4cf03248381475687d227b.zip |
Diffstat (limited to 'recovery_main.cpp')
-rw-r--r-- | recovery_main.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/recovery_main.cpp b/recovery_main.cpp index 5e82c6c1a..c79d7d8d8 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -29,7 +29,6 @@ #include <time.h> #include <unistd.h> -#include <algorithm> #include <string> #include <vector> @@ -287,9 +286,7 @@ int main(int argc, char** argv) { has_cache = volume_for_mount_point(CACHE_ROOT) != nullptr; std::vector<std::string> args = get_args(argc, argv); - std::vector<char*> args_to_parse(args.size()); - std::transform(args.cbegin(), args.cend(), args_to_parse.begin(), - [](const std::string& arg) { return const_cast<char*>(arg.c_str()); }); + auto args_to_parse = StringVectorToNullTerminatedArray(args); static constexpr struct option OPTIONS[] = { { "locale", required_argument, nullptr, 0 }, @@ -302,7 +299,7 @@ int main(int argc, char** argv) { int arg; int option_index; - while ((arg = getopt_long(args_to_parse.size(), args_to_parse.data(), "", OPTIONS, + while ((arg = getopt_long(args_to_parse.size() - 1, args_to_parse.data(), "", OPTIONS, &option_index)) != -1) { switch (arg) { case 't': |