[coreboot-gerrit] Patch set updated for coreboot: cbmem: Exit with an errorlevel of 0 after printing help

Martin Roth (martinroth@google.com) gerrit at coreboot.org
Mon Sep 12 19:47:09 CEST 2016


Martin Roth (martinroth at google.com) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/16574

-gerrit

commit d82a473c6a6877c25ef33c48dd7fda5087d957fd
Author: Martin Roth <martinroth at google.com>
Date:   Sun Sep 11 15:43:22 2016 -0600

    cbmem: Exit with an errorlevel of 0 after printing help
    
    cbmem --help should not return an error to the OS.
    
    Change-Id: Id00091c679dbb109bc352cf8a81d67c2ae5666ec
    Signed-off-by: Martin Roth <martinroth at google.com>
---
 util/cbmem/cbmem.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/util/cbmem/cbmem.c b/util/cbmem/cbmem.c
index 885d460..7b434d8 100644
--- a/util/cbmem/cbmem.c
+++ b/util/cbmem/cbmem.c
@@ -886,7 +886,7 @@ static void print_version(void)
     "GNU General Public License for more details.\n\n");
 }
 
-static void print_usage(const char *name)
+static void print_usage(const char *name, int exit_code)
 {
 	printf("usage: %s [-cCltTxVvh?]\n", name);
 	printf("\n"
@@ -901,7 +901,7 @@ static void print_usage(const char *name)
 	     "   -v | --version:                   print the version\n"
 	     "   -h | --help:                      print this help\n"
 	     "\n");
-	exit(1);
+	exit(exit_code);
 }
 
 #ifdef __arm__
@@ -1086,10 +1086,11 @@ int main(int argc, char** argv)
 			exit(0);
 			break;
 		case 'h':
+			print_usage(argv[0], 0);
+			break;
 		case '?':
 		default:
-			print_usage(argv[0]);
-			exit(0);
+			print_usage(argv[0], 1);
 			break;
 		}
 	}



More information about the coreboot-gerrit mailing list