mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
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: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@industrialdiscipline.com> Acked-by: Yonghong Song <yhs@fb.com> Suggested-by: Quentin Monnet <quentin@isovalent.com> Reviewed-by: Quentin Monnet <quentin@isovalent.com> Link: https://lore.kernel.org/r/20221120112515.38165-4-sahid.ferdjaoui@industrialdiscipline.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
This commit is contained in:
parent
989f285159
commit
d2973ffd25
1 changed files with 2 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue