* [LTP] [PATCH] syscalls/fgetxattr02.c: Fix errno EPERM on older kernels
@ 2018-08-10 2:53 Xiao Yang
2018-08-16 11:39 ` Cyril Hrubis
0 siblings, 1 reply; 2+ messages in thread
From: Xiao Yang @ 2018-08-10 2:53 UTC (permalink / raw)
To: ltp
According to commit 3d2ae5e in LTP, fgetxattr()/getxattr() will set
errno to 'EPERM' when fd/file is not a regular file and directory
before kernel 3.0.0. This errno is changed to ENODATA by commit
55b23bd in kernel, so we accept EPERM in older kernels.
Signed-off-by: Xiao Yang <yangx.jy@cn.fujitsu.com>
---
testcases/kernel/syscalls/fgetxattr/fgetxattr02.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c b/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
index 98a141b..888e29a 100644
--- a/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
+++ b/testcases/kernel/syscalls/fgetxattr/fgetxattr02.c
@@ -185,6 +185,14 @@ static void verify_fgetxattr(unsigned int i)
tc[i].fname + OFFSET);
}
+ /*
+ * Before kernel 3.0.0, fgetxattr(2) will set errno with 'EPERM'
+ * when the file is not a regular file and directory, refer to
+ * commitid 55b23bd
+ */
+ if (tc[i].exp_err == ENODATA && tst_kvercmp(3, 0, 0) < 0)
+ tc[i].exp_err = EPERM;
+
if (tc[i].exp_err == TST_ERR) {
tst_res(TPASS | TTERRNO, "fgetxattr(2) on %s passed",
tc[i].fname + OFFSET);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [LTP] [PATCH] syscalls/fgetxattr02.c: Fix errno EPERM on older kernels
2018-08-10 2:53 [LTP] [PATCH] syscalls/fgetxattr02.c: Fix errno EPERM on older kernels Xiao Yang
@ 2018-08-16 11:39 ` Cyril Hrubis
0 siblings, 0 replies; 2+ messages in thread
From: Cyril Hrubis @ 2018-08-16 11:39 UTC (permalink / raw)
To: ltp
Hi!
Applied, thanks.
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-08-16 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-10 2:53 [LTP] [PATCH] syscalls/fgetxattr02.c: Fix errno EPERM on older kernels Xiao Yang
2018-08-16 11:39 ` Cyril Hrubis
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.