Before kernel 3.0.0, getxattr02 will set errno with 'EPERM' when file is not
regular file and directory.
Refer to commit: 
http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=commit;h=55b23bde19c08f14127a27d461a4e079942c7258

Signed-off-by: Peng Haitao <[email protected]>
---
 testcases/kernel/syscalls/getxattr/getxattr02.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/getxattr/getxattr02.c 
b/testcases/kernel/syscalls/getxattr/getxattr02.c
index 54d8949..ee859cc 100644
--- a/testcases/kernel/syscalls/getxattr/getxattr02.c
+++ b/testcases/kernel/syscalls/getxattr/getxattr02.c
@@ -78,6 +78,7 @@ int main(int argc, char *argv[])
 {
        int lc;
        int i;
+       int exp_eno;
        char *msg;
        char buf[BUFSIZ];
 
@@ -87,17 +88,22 @@ int main(int argc, char *argv[])
 
        setup();
 
+       if ((tst_kvercmp(3, 0, 0)) >= 0)
+               exp_eno = ENODATA;
+       else
+               exp_eno = EPERM;
+
        for (lc = 0; TEST_LOOPING(lc); lc++) {
                Tst_count = 0;
 
                for (i = 0; i < TST_TOTAL; i++) {
                        TEST(getxattr(tc[0], XATTR_TEST_KEY, buf, BUFSIZ));
 
-                       if (TEST_RETURN == -1 && TEST_ERRNO == ENODATA) {
+                       if (TEST_RETURN == -1 && TEST_ERRNO == exp_eno) {
                                tst_resm(TPASS | TTERRNO, "expected behavior");
                        } else {
                                tst_resm(TFAIL | TTERRNO, "unexpected behavior"
-                                   " - expected errno %d - Got", ENODATA);
+                                   " - expected errno %d - Got", exp_eno);
                        }
                }
        }
-- 
1.7.1

-- 
Best Regards,
Peng


------------------------------------------------------------------------------
Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex
infrastructure or vast IT resources to deliver seamless, secure access to
virtual desktops. With this all-in-one solution, easily deploy virtual 
desktops for less than the cost of PCs and save 60% on VDI infrastructure 
costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

Reply via email to