Skip to content

Commit 36ef9a2

Browse files
aspskAlexei Starovoitov
authored andcommitted
selftests/bpf: Cleanup some file descriptors in test_maps
The test_map_rdonly and test_map_wronly tests should close file descriptors which they open. Signed-off-by: Anton Protopopov <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 204fb04 commit 36ef9a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

tools/testing/selftests/bpf/test_maps.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,6 +1401,8 @@ static void test_map_rdonly(void)
14011401
/* Check that key=2 is not found. */
14021402
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT);
14031403
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == ENOENT);
1404+
1405+
close(fd);
14041406
}
14051407

14061408
static void test_map_wronly(void)
@@ -1423,6 +1425,8 @@ static void test_map_wronly(void)
14231425
/* Check that key=2 is not found. */
14241426
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == EPERM);
14251427
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == EPERM);
1428+
1429+
close(fd);
14261430
}
14271431

14281432
static void prepare_reuseport_grp(int type, int map_fd, size_t map_elem_size,

0 commit comments

Comments
 (0)