From: Quentin Monnet Date: Thu, 19 Oct 2017 22:46:20 +0000 (-0700) Subject: tools: bpftool: fix return value when all eBPF programs have been shown X-Git-Tag: v4.15-rc1~84^2~369^2~6 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=1739c26da72c4170c86c368c75133adbb740efef;p=linux.git 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 Signed-off-by: Jakub Kicinski Acked-by: Daniel Borkmann Signed-off-by: David S. Miller --- 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");