Browse Source

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
pull/34/head
Sandrine Bailleux 11 years ago
committed by Dan Handley
parent
commit
399aacd68f
  1. 23
      tools/fip_create/fip_create.c

23
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.
*/

Loading…
Cancel
Save