[PATCH v0 14/20] ubi-utils: ubiblock: Return error code if command line option is unknown
Daniel Wagner
daniel.wagner at siemens.com
Mon Jun 12 03:50:55 PDT 2017
The tool 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.
Signed-off-by: Daniel Wagner <daniel.wagner at siemens.com>
---
ubi-utils/ubiblock.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/ubi-utils/ubiblock.c b/ubi-utils/ubiblock.c
index 1e12be8fb978..8e366789a88c 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();
--
2.9.4
More information about the linux-mtd
mailing list