Skip to content

Commit

Permalink
tools: bpftool: add error message on pin failure
Browse files Browse the repository at this point in the history
No error message is currently printed if the pin syscall
itself fails. It got lost in the loadall refactoring.

Fixes: 7738099 ("bpftool: add loadall command")
Reported-by: Andy Lutomirski <[email protected]>
Signed-off-by: Jakub Kicinski <[email protected]>
Reviewed-by: Quentin Monnet <[email protected]>
Acked-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
  • Loading branch information
Jakub Kicinski authored and borkmann committed Aug 9, 2019
1 parent b3e78ad commit 3c7be38
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/bpf/bpftool/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,11 @@ int do_pin_fd(int fd, const char *name)
if (err)
return err;

return bpf_obj_pin(fd, name);
err = bpf_obj_pin(fd, name);
if (err)
p_err("can't pin the object (%s): %s", name, strerror(errno));

return err;
}

int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))
Expand Down

0 comments on commit 3c7be38

Please sign in to comment.