提交 d2973ffd 编写于 作者: S Sahid Orentino Ferdjaoui 提交者: Alexei Starovoitov

bpftool: fix error message when function can't register struct_ops

It is expected that errno be passed to strerror(). This also cleans
this part of code from using libbpf_get_error().
Signed-off-by: NSahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com>
Acked-by: NYonghong Song <yhs@fb.com>
Suggested-by: NQuentin Monnet <quentin@isovalent.com>
Reviewed-by: NQuentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20221120112515.38165-4-sahid.ferdjaoui@industrialdiscipline.comSigned-off-by: NAlexei Starovoitov <ast@kernel.org>
上级 989f2851
...@@ -511,10 +511,9 @@ static int do_register(int argc, char **argv) ...@@ -511,10 +511,9 @@ static int do_register(int argc, char **argv)
continue; continue;
link = bpf_map__attach_struct_ops(map); link = bpf_map__attach_struct_ops(map);
if (libbpf_get_error(link)) { if (!link) {
p_err("can't register struct_ops %s: %s", p_err("can't register struct_ops %s: %s",
bpf_map__name(map), bpf_map__name(map), strerror(errno));
strerror(-PTR_ERR(link)));
nr_errs++; nr_errs++;
continue; continue;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册