Merge "recovery: Don't report unrecognized option in recovery_main." am: 785d0b4efa am: e9788bc361 am: 7b72231ffa
am: a5898a4e85

Change-Id: I2bf94686d7403bbaa82ea59458c3e3a5d1d12c9f
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 28197bf..a04c1bb 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -351,6 +351,12 @@
   std::string locale;
   std::string reason;
 
+  // The code here is only interested in the options that signal the intent to start fastbootd or
+  // recovery. Unrecognized options are likely meant for recovery, which will be processed later in
+  // start_recovery(). Suppress the warnings for such -- even if some flags were indeed invalid, the
+  // code in start_recovery() will capture and report them.
+  opterr = 0;
+
   int arg;
   int option_index;
   while ((arg = getopt_long(args_to_parse.size() - 1, args_to_parse.data(), "", OPTIONS,
@@ -374,6 +380,7 @@
     }
   }
   optind = 1;
+  opterr = 1;
 
   if (locale.empty()) {
     if (HasCache()) {