summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2019-09-19 22:38:32 +0200
committerandroid-build-merger <android-build-merger@google.com>2019-09-19 22:38:32 +0200
commita5898a4e851c56fb205025b14af2923c8b4954b6 (patch)
tree9ec9654e6e0f01bde863be273e300ff91f5363b0
parentMerge "tests: recovery_unit_test requires root." am: 15a381e52c am: 687bb18724 (diff)
parentMerge "recovery: Don't report unrecognized option in recovery_main." am: 785d0b4efa (diff)
downloadandroid_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar.gz
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar.bz2
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar.lz
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar.xz
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.tar.zst
android_bootable_recovery-a5898a4e851c56fb205025b14af2923c8b4954b6.zip
-rw-r--r--recovery_main.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/recovery_main.cpp b/recovery_main.cpp
index 28197bf40..a04c1bbae 100644
--- a/recovery_main.cpp
+++ b/recovery_main.cpp
@@ -351,6 +351,12 @@ int main(int argc, char** argv) {
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 @@ int main(int argc, char** argv) {
}
}
optind = 1;
+ opterr = 1;
if (locale.empty()) {
if (HasCache()) {