diff mbox

[v0,19/20] ubi-utils: ubiupdatevol: Return error code if command line option is unknown

Message ID 20170612105101.18223-20-daniel.wagner@siemens.com
State Accepted
Delegated to: David Oberhollenzer
Headers show

Commit Message

Daniel Wagner June 12, 2017, 10:51 a.m. UTC
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/ubiupdatevol.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/ubi-utils/ubiupdatevol.c b/ubi-utils/ubiupdatevol.c
index 509679194343..bdcc09180bd7 100644
--- a/ubi-utils/ubiupdatevol.c
+++ b/ubi-utils/ubiupdatevol.c
@@ -109,12 +109,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);