[PATCH v0 06/20] mtd-utils: lash_unlock: Use defines for exit code values

Daniel Wagner daniel.wagner at siemens.com
Mon Jun 12 03:50:47 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>
---
 misc-utils/flash_unlock.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/misc-utils/flash_unlock.c b/misc-utils/flash_unlock.c
index 94f476114355..5a3aac532053 100644
--- a/misc-utils/flash_unlock.c
+++ b/misc-utils/flash_unlock.c
@@ -87,7 +87,7 @@ static void process_args(int argc, char *argv[])
 
 		switch (c) {
 		case 'h':
-			usage(0);
+			usage(EXIT_SUCCESS);
 			break;
 		case 'i':
 			req = REQUEST_ISLOCKED;
@@ -105,14 +105,14 @@ static void process_args(int argc, char *argv[])
 			common_print_version();
 			exit(0);
 		default:
-			usage(1);
+			usage(EXIT_FAILURE);
 			break;
 		}
 	}
 
 	if (req_set > 1) {
 		errmsg("cannot specify more than one lock/unlock/islocked option");
-		usage(1);
+		usage(EXIT_FAILURE);
 	}
 
 	arg_idx = optind;
@@ -120,10 +120,10 @@ static void process_args(int argc, char *argv[])
 	/* Sanity checks */
 	if (argc - arg_idx < 1) {
 		errmsg("too few arguments");
-		usage(1);
+		usage(EXIT_FAILURE);
 	} else if (argc - arg_idx > 3) {
 		errmsg("too many arguments");
-		usage(1);
+		usage(EXIT_FAILURE);
 	}
 
 	/* First non-option argument */
-- 
2.9.4




More information about the linux-mtd mailing list