summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAnton Protopopov <a.s.protopopov@gmail.com>2020-05-27 18:56:57 +0000
committerAlexei Starovoitov <ast@kernel.org>2020-06-01 14:38:21 -0700
commit36ef9a2d3f764a37cf3d8e619bfebf5c99c070a0 (patch)
treeb4ced0e00beae26036791881c3503f2af563cac9 /tools
parent204fb0413a92342d31f3e2557db0bb5babed586c (diff)
downloadlinux-36ef9a2d3f764a37cf3d8e619bfebf5c99c070a0.tar.bz2
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 <a.s.protopopov@gmail.com> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Link: https://lore.kernel.org/bpf/20200527185700.14658-3-a.s.protopopov@gmail.com Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/bpf/test_maps.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index f717acc0c68d..46cf2c232964 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -1401,6 +1401,8 @@ static void test_map_rdonly(void)
/* Check that key=2 is not found. */
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == ENOENT);
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == ENOENT);
+
+ close(fd);
}
static void test_map_wronly(void)
@@ -1423,6 +1425,8 @@ static void test_map_wronly(void)
/* Check that key=2 is not found. */
assert(bpf_map_lookup_elem(fd, &key, &value) == -1 && errno == EPERM);
assert(bpf_map_get_next_key(fd, &key, &value) == -1 && errno == EPERM);
+
+ close(fd);
}
static void prepare_reuseport_grp(int type, int map_fd, size_t map_elem_size,