]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
selftests/landlock: Properly close a file descriptor
authorGünther Noack <gnoack3000@gmail.com>
Thu, 1 Jan 2026 13:40:58 +0000 (14:40 +0100)
committerMickaël Salaün <mic@digikod.net>
Fri, 9 Jan 2026 10:52:47 +0000 (11:52 +0100)
Add a missing close(srv_fd) call, and use EXPECT_EQ() to check the
result.

Signed-off-by: Günther Noack <gnoack3000@gmail.com>
Fixes: f83d51a5bdfe ("selftests/landlock: Check IOCTL restrictions for named UNIX domain sockets")
Link: https://lore.kernel.org/r/20260101134102.25938-2-gnoack3000@gmail.com
[mic: Use EXPECT_EQ() and update commit message]
Signed-off-by: Mickaël Salaün <mic@digikod.net>
tools/testing/selftests/landlock/fs_test.c

index 37a5a3df712ecb186c91e1abd1a0e393ea8457dc..968a91c927a46af71e07e9d5e3bb43d77284a583 100644 (file)
@@ -4399,7 +4399,8 @@ TEST_F_FORK(layout1, named_unix_domain_socket_ioctl)
        /* FIONREAD and other IOCTLs should not be forbidden. */
        EXPECT_EQ(0, test_fionread_ioctl(cli_fd));
 
-       ASSERT_EQ(0, close(cli_fd));
+       EXPECT_EQ(0, close(cli_fd));
+       EXPECT_EQ(0, close(srv_fd));
 }
 
 /* clang-format off */