Message ID | 20170612105101.18223-16-daniel.wagner@siemens.com |
---|---|
State | Accepted |
Delegated to: | David Oberhollenzer |
Headers | show |
diff --git a/ubi-utils/ubiformat.c b/ubi-utils/ubiformat.c index 896fe20cc6a4..ef0378a63403 100644 --- a/ubi-utils/ubiformat.c +++ b/ubi-utils/ubiformat.c @@ -209,11 +209,15 @@ static int parse_opt(int argc, char * const argv[]) exit(EXIT_SUCCESS); 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 ':': return errmsg("parameter is missing");
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@siemens.com> --- ubi-utils/ubiformat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)