Merge "recovery: Fix the argument parsing."

am: 33808f16c5

Change-Id: I9ae6633598262f21cca63f90cd51f6b84e5fead2
This commit is contained in:
Tao Bao
2017-01-09 21:35:39 +00:00
committed by android-build-merger
+2 -2
View File
@@ -322,7 +322,7 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
std::vector<std::string> args(argv, argv + argc); std::vector<std::string> args(argv, argv + argc);
// --- if arguments weren't supplied, look in the bootloader control block // --- if arguments weren't supplied, look in the bootloader control block
if (argc == 1) { if (args.size() == 1) {
boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination boot.recovery[sizeof(boot.recovery) - 1] = '\0'; // Ensure termination
std::string boot_recovery(boot.recovery); std::string boot_recovery(boot.recovery);
std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n"); std::vector<std::string> tokens = android::base::Split(boot_recovery, "\n");
@@ -338,7 +338,7 @@ static std::vector<std::string> get_args(const int argc, char** const argv) {
} }
// --- if that doesn't work, try the command file (if we have /cache). // --- if that doesn't work, try the command file (if we have /cache).
if (argc == 1 && has_cache) { if (args.size() == 1 && has_cache) {
std::string content; std::string content;
if (ensure_path_mounted(COMMAND_FILE) == 0 && if (ensure_path_mounted(COMMAND_FILE) == 0 &&
android::base::ReadFileToString(COMMAND_FILE, &content)) { android::base::ReadFileToString(COMMAND_FILE, &content)) {