From 49fd5d262c6764b0a6746cfdb267e8bebec49256 Mon Sep 17 00:00:00 2001 From: Jerry Zhang Date: Thu, 17 May 2018 12:54:41 -0700 Subject: 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 --- recovery_main.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'recovery_main.cpp') diff --git a/recovery_main.cpp b/recovery_main.cpp index e21c782d0..5e82c6c1a 100644 --- a/recovery_main.cpp +++ b/recovery_main.cpp @@ -317,6 +317,7 @@ int main(int argc, char** argv) { } } } + optind = 1; if (locale.empty()) { if (has_cache) { -- cgit v1.2.3