[PATCH v0 16/20] ubi-utils: ubimkvol: Return error code if command line option is unknown
Daniel Wagner
daniel.wagner at siemens.com
Mon Jun 12 03:50:57 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.
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 at siemens.com>
---
ubi-utils/ubimkvol.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/ubi-utils/ubimkvol.c b/ubi-utils/ubimkvol.c
index fdbc67ffb781..b81fc99c949e 100644
--- a/ubi-utils/ubimkvol.c
+++ b/ubi-utils/ubimkvol.c
@@ -164,12 +164,17 @@ static int parse_opt(int argc, char * const argv[])
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();
exit(EXIT_SUCCESS);
--
2.9.4
More information about the linux-mtd
mailing list