[PATCH v0 05/20] jffsX-utils: Return error code if command line option is unknown

Daniel Wagner daniel.wagner at siemens.com
Mon Jun 12 03:50:46 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>
---
 jffsX-utils/sumtool.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/jffsX-utils/sumtool.c b/jffsX-utils/sumtool.c
index 09586155f74c..a995bdf21d8e 100644
--- a/jffsX-utils/sumtool.c
+++ b/jffsX-utils/sumtool.c
@@ -156,9 +156,11 @@ void process_options (int argc, char **argv)
 				target_endian = __LITTLE_ENDIAN;
 				break;
 			case 'h':
-			case '?':
 				puts(helptext);
 				exit(EXIT_SUCCESS);
+			case '?':
+				puts(helptext);
+				exit(EXIT_FAILURE);
 			case 'v':
 				verbose = 1;
 				break;
-- 
2.9.4




More information about the linux-mtd mailing list