[PATCH v0 13/20] integrity: Return error code if command line option is unknown
Daniel Wagner
daniel.wagner at siemens.com
Mon Jun 12 03:50:54 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>
---
tests/fs-tests/integrity/integck.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/fs-tests/integrity/integck.c b/tests/fs-tests/integrity/integck.c
index 7cb530515d42..827adc5205bf 100644
--- a/tests/fs-tests/integrity/integck.c
+++ b/tests/fs-tests/integrity/integck.c
@@ -3080,10 +3080,13 @@ static int parse_opts(int argc, char * const argv[])
exit(EXIT_SUCCESS);
case 'h':
- case '?':
fprintf(stderr, "%s\n\n", doc);
fprintf(stderr, "%s\n", optionsstr);
exit(EXIT_SUCCESS);
+ case '?':
+ fprintf(stderr, "%s\n\n", doc);
+ fprintf(stderr, "%s\n", optionsstr);
+ exit(-1);
case ':':
return errmsg("parameter is missing");
--
2.9.4
More information about the linux-mtd
mailing list