diff options
author | Tao Bao <tbao@google.com> | 2016-12-09 20:59:09 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-12-09 20:59:09 +0100 |
commit | d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb (patch) | |
tree | d83a9df7015e76006c8e08025d011c13d7253980 /recovery.cpp | |
parent | Merge "recovery: Clean up get_args()." am: 3aadbbac39 (diff) | |
parent | Merge "recovery: Fix the argument parsing from COMMAND_FILE." (diff) | |
download | android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar.gz android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar.bz2 android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar.lz android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar.xz android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.tar.zst android_bootable_recovery-d4ceb1fb64d4e4e36a884a159cf5904f1faa00bb.zip |
Diffstat (limited to 'recovery.cpp')
-rw-r--r-- | recovery.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/recovery.cpp b/recovery.cpp index 5f1607553..e16f28c72 100644 --- a/recovery.cpp +++ b/recovery.cpp @@ -350,9 +350,12 @@ 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 (argc == 1 && has_cache) { std::string content; - if (android::base::ReadFileToString(COMMAND_FILE, &content)) { + if (ensure_path_mounted(COMMAND_FILE) == 0 && + android::base::ReadFileToString(COMMAND_FILE, &content)) { std::vector<std::string> tokens = android::base::Split(content, "\n"); - for (auto it = tokens.begin() + 1; it != tokens.end(); it++) { + // All the arguments in COMMAND_FILE are needed (unlike the BCB message, + // COMMAND_FILE doesn't use filename as the first argument). + for (auto it = tokens.begin(); it != tokens.end(); it++) { // Skip empty and '\0'-filled tokens. if (!it->empty() && (*it)[0] != '\0') args.push_back(std::move(*it)); } |