]> Git Repo - linux.git/commitdiff
objtool: Print top level commands on incorrect usage
authorKamalesh Babulal <[email protected]>
Sat, 14 Oct 2017 14:47:54 +0000 (20:17 +0530)
committerIngo Molnar <[email protected]>
Wed, 18 Oct 2017 13:22:26 +0000 (15:22 +0200)
Print top-level objtool commands, along with the error on incorrect
command line usage. Objtool command line parser exit's with code 129,
for incorrect usage. Convert the cmd_usage() exit code also, to maintain
consistency across objtool.

After the patch:

  $ ./objtool -j

  Unknown option: -j

  usage: objtool COMMAND [ARGS]

  Commands:
     check   Perform stack metadata validation on an object file
     orc     Generate in-place ORC unwind tables for an object file

  $ echo $?
  129

Signed-off-by: Kamalesh Babulal <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
tools/objtool/objtool.c

index 31e0f91438400677d654f0d23ea1011dc69588ed..07f32991982840b74b6feaed10056c4a0127083c 100644 (file)
@@ -70,7 +70,7 @@ static void cmd_usage(void)
 
        printf("\n");
 
-       exit(1);
+       exit(129);
 }
 
 static void handle_options(int *argc, const char ***argv)
@@ -86,9 +86,7 @@ static void handle_options(int *argc, const char ***argv)
                        break;
                } else {
                        fprintf(stderr, "Unknown option: %s\n", cmd);
-                       fprintf(stderr, "\n Usage: %s\n",
-                               objtool_usage_string);
-                       exit(1);
+                       cmd_usage();
                }
 
                (*argv)++;
This page took 0.059073 seconds and 4 git commands to generate.