summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2017-05-17 22:02:11 +0200
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-05-17 22:02:12 +0200
commit0e60ccdc76f94a62be6f1817e200ced63a8b52f7 (patch)
tree2e76bdbeb6a4de0434c9060d7dc91ab3ab702102
parentMerge "updater: Update the mkfs.f2fs argument to match f2fs-tools 1.8.0." (diff)
parentFix the input parameter for "set_retry_bootloader_message" (diff)
downloadandroid_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar.gz
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar.bz2
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar.lz
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar.xz
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.tar.zst
android_bootable_recovery-0e60ccdc76f94a62be6f1817e200ced63a8b52f7.zip
-rw-r--r--recovery.cpp26
1 files changed, 13 insertions, 13 deletions
diff --git a/recovery.cpp b/recovery.cpp
index 944c24086..dfae7f03d 100644
--- a/recovery.cpp
+++ b/recovery.cpp
@@ -1304,20 +1304,20 @@ static bool is_battery_ok() {
}
}
-static void set_retry_bootloader_message(int retry_count, int argc, char** argv) {
- std::vector<std::string> options;
- for (int i = 1; i < argc; ++i) {
- if (strstr(argv[i], "retry_count") == nullptr) {
- options.push_back(argv[i]);
- }
+static void set_retry_bootloader_message(int retry_count, const std::vector<std::string>& args) {
+ std::vector<std::string> options;
+ for (const auto& arg : args) {
+ if (!android::base::StartsWith(arg, "--retry_count")) {
+ options.push_back(arg);
}
+ }
- // Increment the retry counter by 1.
- options.push_back(android::base::StringPrintf("--retry_count=%d", retry_count+1));
- std::string err;
- if (!update_bootloader_message(options, &err)) {
- LOG(ERROR) << err;
- }
+ // Increment the retry counter by 1.
+ options.push_back(android::base::StringPrintf("--retry_count=%d", retry_count + 1));
+ std::string err;
+ if (!update_bootloader_message(options, &err)) {
+ LOG(ERROR) << err;
+ }
}
static bool bootreason_in_blacklist() {
@@ -1534,7 +1534,7 @@ int main(int argc, char **argv) {
// times before we abandon this OTA update.
if (status == INSTALL_RETRY && retry_count < EIO_RETRY_COUNT) {
copy_logs();
- set_retry_bootloader_message(retry_count, argc, argv);
+ set_retry_bootloader_message(retry_count, args);
// Print retry count on screen.
ui->Print("Retry attempt %d\n", retry_count);