提交 957f9a13 编写于 作者: J Jakub Kicinski 提交者: Daniel Borkmann

tools: bpftool: remove duplicated error message on prog load

do_pin_fd() will already print out an error message if something
goes wrong.  Printing another error is unnecessary and will break
JSON output, since error messages are full objects:

$ bpftool -jp prog load tracex1_kern.o /sys/fs/bpf/a
{
    "error": "can't pin the object (/sys/fs/bpf/a): File exists"
},{
    "error": "failed to pin program"
}

Fixes: 49a086c2 ("bpftool: implement prog load command")
Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
Acked-by: NSong Liu <songliubraving@fb.com>
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
上级 3739a21e
......@@ -694,10 +694,8 @@ static int do_load(int argc, char **argv)
return -1;
}
if (do_pin_fd(prog_fd, argv[1])) {
p_err("failed to pin program");
if (do_pin_fd(prog_fd, argv[1]))
return -1;
}
if (json_output)
jsonw_null(json_wtr);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册