summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2016-12-09 21:19:40 +0100
committerandroid-build-merger <android-build-merger@google.com>2016-12-09 21:19:40 +0100
commit584d1f242289dfb5f5c3e80725fffe1dd5145805 (patch)
treef6a45371e044700f95b325108dd0eca5ae2635da
parentMerge "recovery: Clean up get_args()." am: 3aadbbac39 am: c3ab25c237 am: dd9c5674df (diff)
parentMerge "recovery: Fix the argument parsing from COMMAND_FILE." am: 332af25b7c am: 6be6680109 (diff)
downloadandroid_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar.gz
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar.bz2
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar.lz
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar.xz
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.tar.zst
android_bootable_recovery-584d1f242289dfb5f5c3e80725fffe1dd5145805.zip
Diffstat (limited to '')
-rw-r--r--recovery.cpp7
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));
}