]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
tools: bpftool: fix return value when all eBPF programs have been shown
authorQuentin Monnet <quentin.monnet@netronome.com>
Thu, 19 Oct 2017 22:46:20 +0000 (15:46 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 22 Oct 2017 01:11:32 +0000 (02:11 +0100)
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>
tools/bpf/bpftool/prog.c

index aa6d72ea3807b48f8ee53afe738f982597c56a45..ede7957adcd9ba22198f0e78b83c2a2c35e3a63b 100644 (file)
@@ -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");