diff options
author | Sandrine Bailleux <sandrine.bailleux@arm.com> | 2014-03-19 13:39:52 +0000 |
---|---|---|
committer | Dan Handley <dan.handley@arm.com> | 2014-03-21 17:17:48 +0000 |
commit | 399aacd68f64a98fb9c01d2f63502b869b0e7f70 (patch) | |
tree | 618591ab595915c8d9451e801c8057aa284e379a /tools | |
parent | 89f7b481bdd6ef302e1182bfb902ce98eee0fd94 (diff) |
FIP tool: Fix error message for missing FIP filename
Previously to this path, the FIP tool used to print the following,
misleading error message when called without any argument or with
'--help' option:
ERROR: Too many arguments
This patch fixes this behavior by printing the following error
message instead:
ERROR: Missing FIP filename
If called with '--help', no error message is printed and only the
help message is displayed.
Change-Id: Ib281b056f5cd3bc2f66d98be0b0cb2a0aed7c6a8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/fip_create/fip_create.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/tools/fip_create/fip_create.c b/tools/fip_create/fip_create.c index a0fdd0ab..71ee1de9 100644 --- a/tools/fip_create/fip_create.c +++ b/tools/fip_create/fip_create.c @@ -509,11 +509,8 @@ static char *get_filename(int argc, char **argv, struct option *options) /* Only one argument left then it is the filename. * We dont expect any other options */ - if (optind + 1 == argc) { + if (optind + 1 == argc) filename = argv[optind]; - } else { - printf("ERROR: Too many arguments.\n"); - } return filename; } @@ -638,15 +635,13 @@ int main(int argc, char **argv) * it causes a failure if bad options were provided. */ fip_filename = get_filename(argc, argv, long_options); - if (fip_filename == NULL) { - print_usage(); - return 0; - } /* Try to open the file and load it into memory */ - status = parse_fip(fip_filename); - if (status != 0) { - return status; + if (fip_filename != NULL) { + status = parse_fip(fip_filename); + if (status != 0) { + return status; + } } /* Work through provided program arguments and perform actions */ @@ -655,6 +650,12 @@ int main(int argc, char **argv) return status; }; + if (fip_filename == NULL) { + printf("ERROR: Missing FIP filename\n"); + print_usage(); + return 0; + } + /* Processed all command line options. Create/update the package if * required. */ |