提交 f2e72a0b 编写于 作者: D Daniel Borkmann

Merge branch 'bpf-bpftool-fixes'

Jakub Kicinski says:

====================
Two small fixes for error handling in bpftool prog load, first patch
removes a duplicated message, second one frees resources correctly.
Multiple error messages break JSON:

{
    "error": "can't pin the object (/sys/fs/bpf/a): File exists"
},{
    "error": "failed to pin program"
}
====================
Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
...@@ -694,15 +694,19 @@ static int do_load(int argc, char **argv) ...@@ -694,15 +694,19 @@ static int do_load(int argc, char **argv)
return -1; return -1;
} }
if (do_pin_fd(prog_fd, argv[1])) { if (do_pin_fd(prog_fd, argv[1]))
p_err("failed to pin program"); goto err_close_obj;
return -1;
}
if (json_output) if (json_output)
jsonw_null(json_wtr); jsonw_null(json_wtr);
bpf_object__close(obj);
return 0; return 0;
err_close_obj:
bpf_object__close(obj);
return -1;
} }
static int do_help(int argc, char **argv) static int do_help(int argc, char **argv)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册