[LTP] [PATCH v2] finit_module02: fix exp. errno for O_WRONLY testcase
Jan Stancek
jstancek@redhat.com
Tue Oct 26 12:42:26 CEST 2021
commit 032146cda855 ("vfs: check fd has read access in
kernel_read_file_from_fd()") changed errno back to EBADF,
which is correct value according to man page. Drop the
workaround and always expect EBADF for O_WRONLY testcase.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
---
.../syscalls/finit_module/finit_module02.c | 16 ++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)
diff --git a/testcases/kernel/syscalls/finit_module/finit_module02.c b/testcases/kernel/syscalls/finit_module/finit_module02.c
index 0d2bf917ea64..47b5edbfb527 100644
--- a/testcases/kernel/syscalls/finit_module/finit_module02.c
+++ b/testcases/kernel/syscalls/finit_module/finit_module02.c
@@ -50,14 +50,6 @@ static void bad_fd_setup(struct tcase *tc)
tc->exp_errno = EBADF;
}
-static void wo_file_setup(struct tcase *tc)
-{
- if (tst_kvercmp(4, 6, 0) < 0)
- tc->exp_errno = EBADF;
- else
- tc->exp_errno = ETXTBSY;
-}
-
static void dir_setup(struct tcase *tc)
{
if (tst_kvercmp(4, 6, 0) < 0)
@@ -78,8 +70,8 @@ static struct tcase tcases[] = {
{"no-perm", &fd, "", O_RDONLY | O_CLOEXEC, 0, 1, EPERM, 0, NULL},
{"module-exists", &fd, "", O_RDONLY | O_CLOEXEC, 0, 0, EEXIST, 1,
NULL},
- {"file-not-readable", &fd, "", O_WRONLY | O_CLOEXEC, 0, 0, 0, 0,
- wo_file_setup},
+ {"file-not-readable", &fd, "", O_WRONLY | O_CLOEXEC, 0, 0, EBADF, 0,
+ NULL},
{"directory", &fd_dir, "", O_RDONLY | O_CLOEXEC, 0, 0, 0, 0, dir_setup},
};
@@ -140,6 +132,10 @@ static void run(unsigned int n)
}
static struct tst_test test = {
+ .tags = (const struct tst_tag[]) {
+ {"linux-git", "032146cda855"},
+ {}
+ },
.test = run,
.tcnt = ARRAY_SIZE(tcases),
.setup = setup,
--
2.27.0
More information about the ltp
mailing list