Commit 1739c26d authored by Quentin Monnet's avatar Quentin Monnet Committed by David S. Miller

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: default avatarQuentin Monnet <quentin.monnet@netronome.com>
Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
Acked-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9cbe1f58
...@@ -275,8 +275,10 @@ static int do_show(int argc, char **argv) ...@@ -275,8 +275,10 @@ static int do_show(int argc, char **argv)
while (true) { while (true) {
err = bpf_prog_get_next_id(id, &id); err = bpf_prog_get_next_id(id, &id);
if (err) { if (err) {
if (errno == ENOENT) if (errno == ENOENT) {
err = 0;
break; break;
}
err("can't get next program: %s\n", strerror(errno)); err("can't get next program: %s\n", strerror(errno));
if (errno == EINVAL) if (errno == EINVAL)
err("kernel too old?\n"); err("kernel too old?\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment