recovery: Reset optind to 1 after getopt

The getopt library exposes optind which is the
next index to be processed. When scanning is
restarted, optind has to be reset to 1.

Test: Recovery works
Bug: 78793464
Change-Id: I1efca3fb985ffbdfe91e43767469733cda6e7d5b
This commit is contained in:
Jerry Zhang 2018-05-17 12:54:41 -07:00
parent 2ddc54f5fd
commit 49fd5d262c
2 changed files with 2 additions and 0 deletions

View file

@ -1049,6 +1049,7 @@ Device::BuiltinAction start_recovery(Device* device, const std::vector<std::stri
continue;
}
}
optind = 1;
printf("stage is [%s]\n", stage.c_str());
printf("reason is [%s]\n", reason);

View file

@ -317,6 +317,7 @@ int main(int argc, char** argv) {
}
}
}
optind = 1;
if (locale.empty()) {
if (has_cache) {