It is expected that errno be passed to strerror(). Signed-off-by: Sahid Orentino Ferdjaoui <sahid.ferdjaoui@xxxxxxxxxxxxxxxxxxxxxxxx> --- tools/bpf/bpftool/struct_ops.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/bpf/bpftool/struct_ops.c b/tools/bpf/bpftool/struct_ops.c index 68281f9b7a0e..e0927dbb837b 100644 --- a/tools/bpf/bpftool/struct_ops.c +++ b/tools/bpf/bpftool/struct_ops.c @@ -513,8 +513,7 @@ static int do_register(int argc, char **argv) link = bpf_map__attach_struct_ops(map); if (libbpf_get_error(link)) { p_err("can't register struct_ops %s: %s", - bpf_map__name(map), - strerror(-PTR_ERR(link))); + bpf_map__name(map), strerror(errno)); nr_errs++; continue; } -- 2.34.1