summaryrefslogtreecommitdiff
path: root/ubi-utils/ubiblock.c
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@siemens.com>2017-06-12 12:50:54 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2017-06-14 11:00:30 +0200
commit76e27a79eddb6279bbbc0ec840d66b753a9ba0f3 (patch)
tree50650ace637991c5845b15a7800e67f7cdece62b /ubi-utils/ubiblock.c
parentb8e785a96f907022466bd383ec6afaa201e5f759 (diff)
ubi-utils: Return error code if command line option is unknown
The tools in question will quit with an exit code 0 if the command line option was not recognized. By returning an error code a calling script has the possibility to distinguish between a real success and an invalid invocation. We need to return -1 instead of EXIT_FAILURE to be consistent with the other exit code places. Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'ubi-utils/ubiblock.c')
-rw-r--r--ubi-utils/ubiblock.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ubi-utils/ubiblock.c b/ubi-utils/ubiblock.c
index 1e12be8..8e36678 100644
--- a/ubi-utils/ubiblock.c
+++ b/ubi-utils/ubiblock.c
@@ -78,11 +78,15 @@ static int parse_opt(int argc, char * const argv[])
args.node = optarg;
break;
case 'h':
- case '?':
printf("%s\n\n", doc);
printf("%s\n\n", usage);
printf("%s\n", optionsstr);
exit(EXIT_SUCCESS);
+ case '?':
+ printf("%s\n\n", doc);
+ printf("%s\n\n", usage);
+ printf("%s\n", optionsstr);
+ return -1;
case 'V':
common_print_version();