Skip to content

Commit f884058

Browse files
nswonKernel Patches Daemon
authored and
Kernel Patches Daemon
committed
bpf: bpftool: Setting error code in do_loader()
missing error code in do_loader() bpf_object__open_file() failed, but return 0 This means the command's exit status code was successful, so make sure to return the correct error code. To maintain consistency with other locations where bpf_object__open_file() is called, it returns -1 instead. Link: https://lore.kernel.org/bpf/[email protected]/t/#u Closes: libbpf/bpftool#156 Signed-off-by: Sewon Nam <[email protected]> Reported-by: Dan Carpenter <[email protected]> Tested-by: Quentin Monnet <[email protected]> Reviewed-by: Quentin Monnet <[email protected]>
1 parent 474f6ed commit f884058

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/bpf/bpftool/prog.c

+1
Original file line numberDiff line numberDiff line change
@@ -1928,6 +1928,7 @@ static int do_loader(int argc, char **argv)
19281928

19291929
obj = bpf_object__open_file(file, &open_opts);
19301930
if (!obj) {
1931+
err = -1;
19311932
p_err("failed to open object file");
19321933
goto err_close_obj;
19331934
}

0 commit comments

Comments
 (0)