[net-next,4/8] tools: bpftool: add `bpftool prog help` as real command i.r.t exit code

Message ID 20171019224626.31608-5-jakub.kicinski@netronome.com
State Accepted
Delegated to: David Miller
Headers show
Series
  • tools: bpftool: add a "version" command, and fix several items
Related show

Commit Message

Jakub Kicinski Oct. 19, 2017, 10:46 p.m.
From: Quentin Monnet <quentin.monnet@netronome.com>

Make error messages and return codes more consistent. Specifically, make
`bpftool prog help` a real command, instead of printing usage by default
for a non-recognized "help" command. Output is the same, but this makes
bpftool return with a success value instead of an error.

Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
---
 tools/bpf/bpftool/prog.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Daniel Borkmann Oct. 20, 2017, 10:56 a.m. | #1
On 10/20/2017 12:46 AM, Jakub Kicinski wrote:
> From: Quentin Monnet <quentin.monnet@netronome.com>
>
> Make error messages and return codes more consistent. Specifically, make
> `bpftool prog help` a real command, instead of printing usage by default
> for a non-recognized "help" command. Output is the same, but this makes
> bpftool return with a success value instead of an error.
>
> Signed-off-by: Quentin Monnet <quentin.monnet@netronome.com>
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>

Acked-by: Daniel Borkmann <daniel@iogearbox.net>

Patch

diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 6c03d2ea3f79..355c14325622 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -475,6 +475,7 @@  static int do_help(int argc, char **argv)
 
 static const struct cmd cmds[] = {
 	{ "show",	do_show },
+	{ "help",	do_help },
 	{ "dump",	do_dump },
 	{ "pin",	do_pin },
 	{ 0 }