Skip to content

Commit

Permalink
tools: bpftool: fix return value when all eBPF programs have been shown
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Quentin Monnet authored and David S. Miller committed Oct 22, 2017
1 parent 9cbe1f5 commit 1739c26
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/bpf/bpftool/prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 1739c26

Please sign in to comment.