aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuentin Monnet <quentin.monnet@netronome.com>2017-10-19 15:46:20 -0700
committerDavid S. Miller <davem@davemloft.net>2017-10-22 02:11:32 +0100
commit1739c26da72c4170c86c368c75133adbb740efef (patch)
tree7442f029db148ae80dcb1b04850a6107211189ea /tools
parenttools: bpftool: add pointer to file argument to print_hex() (diff)
downloadlinux-dev-1739c26da72c4170c86c368c75133adbb740efef.tar.xz
linux-dev-1739c26da72c4170c86c368c75133adbb740efef.zip
tools: bpftool: fix return value when all eBPF programs have been shown
Change the program to have a more consistent return code. Specifically, do not make bpftool return an error code simply because it reaches the end of the list of the eBPF programs to show. 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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'tools')
-rw-r--r--tools/bpf/bpftool/prog.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index aa6d72ea3807..ede7957adcd9 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -275,8 +275,10 @@ static int do_show(int argc, char **argv)
while (true) {
err = bpf_prog_get_next_id(id, &id);
if (err) {
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ err = 0;
break;
+ }
err("can't get next program: %s\n", strerror(errno));
if (errno == EINVAL)
err("kernel too old?\n");