[PATCH v0 03/20] mkfs.jffs2: Return error code if command line option is unknown

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

diff --git a/jffsX-utils/mkfs.jffs2.c b/jffsX-utils/mkfs.jffs2.c
index ca5e0d560f98..c77f19005b3e 100644
--- a/jffsX-utils/mkfs.jffs2.c
+++ b/jffsX-utils/mkfs.jffs2.c
@@ -1629,9 +1629,11 @@ int main(int argc, char **argv)
 				break;
 
 			case 'h':
-			case '?':
 				puts(helptext);
 				exit(EXIT_SUCCESS);
+			case '?':
+				puts(helptext);
+				exit(EXIT_FAILURE);
 
 			case 'v':
 				verbose = 1;
-- 
2.9.4




More information about the linux-mtd mailing list