diff options
author | Gilad Arnold <garnold@google.com> | 2015-09-17 05:17:14 -0700 |
---|---|---|
committer | Gilad Arnold <garnold@google.com> | 2015-09-17 05:52:28 -0700 |
commit | 545dbc4de4cee9b5993e7d62ce6b50f920ccd20a (patch) | |
tree | fc14470511230e050f1ca9d8b7eb8be7543e0f4f /bootctl | |
parent | 510ade28faa0a940965dc2d379c42fa45cdea395 (diff) | |
download | extras-545dbc4de4cee9b5993e7d62ce6b50f920ccd20a.tar.gz |
Check command line arguments first.
This allows users to see the usage text before attempting to do actual
work. Particularly useful when bootctrl module consistently fails to
load.
Bug: 24157039
Change-Id: Id0f3fa048f4c88ef87156b79f4fff249a77270b4
Diffstat (limited to 'bootctl')
-rw-r--r-- | bootctl/bootctl.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bootctl/bootctl.c b/bootctl/bootctl.c index 8e0125c4..55eb5bf4 100644 --- a/bootctl/bootctl.c +++ b/bootctl/bootctl.c @@ -147,6 +147,11 @@ int main(int argc, char *argv[]) boot_control_module_t *module; int ret; + if (argc < 2) { + usage(stderr, argc, argv); + return EX_USAGE; + } + ret = hw_get_module("bootctrl", &hw_module); if (ret != 0) { fprintf(stderr, "Error getting bootctrl module.\n"); @@ -155,11 +160,6 @@ int main(int argc, char *argv[]) module = (boot_control_module_t*) hw_module; module->init(module); - if (argc < 2) { - usage(stderr, argc, argv); - return EX_USAGE; - } - if (strcmp(argv[1], "hal-info") == 0) { return do_hal_info(hw_module); } else if (strcmp(argv[1], "get-number-slots") == 0) { |