[PATCH v2 07/27] selftests/landlock: Fix the ruleset_fd check in empty_or_same_ruleset
From: Günther Noack
Date: Wed Nov 04 2026 - 18:58:54 EST
ASSERT_LE(-1, ruleset_fd) is always true, so the test does not check
that creating a ruleset with an empty handled_access_fs fails. Check
for -1 instead.
Signed-off-by: Günther Noack <gnoack3000@xxxxxxxxx>
---
tools/testing/selftests/landlock/fs_test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/landlock/fs_test.c b/tools/testing/selftests/landlock/fs_test.c
index f725882fa4a7..7d399c097c93 100644
--- a/tools/testing/selftests/landlock/fs_test.c
+++ b/tools/testing/selftests/landlock/fs_test.c
@@ -1456,7 +1456,7 @@ TEST_F_FORK(layout1, empty_or_same_ruleset)
/* Tests empty handled_access_fs. */
ruleset_fd =
landlock_create_ruleset(&ruleset_attr, sizeof(ruleset_attr), 0);
- ASSERT_LE(-1, ruleset_fd);
+ ASSERT_EQ(-1, ruleset_fd);
ASSERT_EQ(ENOMSG, errno);
/* Enforces policy which denies read access to all files. */
--
2.56.0