Skip to content

Commit 2acc3c1

Browse files
Wang Haiborkmann
authored andcommitted
selftests/bpf: Fix error return code in run_getsockopt_test()
Fix to return a negative error code from the error handling case instead of 0, as done elsewhere in this function. Fixes: 65b4414 ("selftests/bpf: add sockopt test that exercises BPF_F_ALLOW_MULTI") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Wang Hai <wanghai38@huawei.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20201116101633.64627-1-wanghai38@huawei.com
1 parent f782e2c commit 2acc3c1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tools/testing/selftests/bpf/prog_tests/sockopt_multi.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ static int run_getsockopt_test(struct bpf_object *obj, int cg_parent,
138138
*/
139139

140140
buf = 0x40;
141-
if (setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1) < 0) {
141+
err = setsockopt(sock_fd, SOL_IP, IP_TOS, &buf, 1);
142+
if (err < 0) {
142143
log_err("Failed to call setsockopt(IP_TOS)");
143144
goto detach;
144145
}

0 commit comments

Comments
 (0)