Skip to content

Commit

Permalink
Merge branch 'bpf-bpftool-pinning-error-msg'
Browse files Browse the repository at this point in the history
Jakub Kicinski says:

====================
First make sure we don't use "prog" in error messages because
the pinning operation could be performed on a map. Second add
back missing error message if pin syscall failed.
====================

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
  • Loading branch information
Daniel Borkmann committed Aug 9, 2019
2 parents f1fc724 + 3c7be38 commit 4f7aafd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tools/bpf/bpftool/common.c
Original file line number Diff line number Diff line change
@@ -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))
@@ -237,7 +241,7 @@ int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(__u32))

fd = get_fd_by_id(id);
if (fd < 0) {
p_err("can't get prog by id (%u): %s", id, strerror(errno));
p_err("can't open object by id (%u): %s", id, strerror(errno));
return -1;
}

0 comments on commit 4f7aafd

Please sign in to comment.