summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEnrico Jorns <ejo@pengutronix.de>2017-05-15 17:00:46 +0200
committerEnrico Jorns <ejo@pengutronix.de>2017-06-30 07:32:29 +0200
commit5ef3f9b16827478a3bfd24bc07de89a7732d93b9 (patch)
tree5381b56b8d5e6a35eba7b9416d82c3631af750b8
parent7974f832a0149abef5b981012ec6deba7093ac07 (diff)
downloaddt-utils-5ef3f9b16827478a3bfd24bc07de89a7732d93b9.tar.gz
barebox-state: Fail for unhandled arguments
When passing unhandled arguments as in % barebox-state foo these will be silently ignored. This may lead to misunderstandings and unintended behavior, thus the user should be informed and the programm should exit with an error in these cases. Signed-off-by: Enrico Jorns <ejo@pengutronix.de> Acked-by: Uwe Kleine-K├Ânig <u.kleine-koenig@pengutronix.de>
-rw-r--r--src/barebox-state.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/barebox-state.c b/src/barebox-state.c
index 24e13d2..e68b8cb 100644
--- a/src/barebox-state.c
+++ b/src/barebox-state.c
@@ -499,6 +499,11 @@ int main(int argc, char *argv[])
}
}
+ if (optind < argc) {
+ pr_err("Invalid argument: %s\n", argv[optind]);
+ exit(1);
+ }
+
pr_level_set(pr_level);
if (nr_states == 0) {