Skip to contentSkip to conversation

utimes: fix failure of utimes01

PATCH In review liubo 2 participants 2 messages Oct 13, 2009

lore
Share & tools
lore

liubo

author
#0 lore raw

PATCH 1/1 utimes: fix failure of utimes01

In /testcases/kernel/syscalls/utimes, case02 expects "EACCES" error.

According to utimes's manual,

EACCES times is NULL, the caller’s effective user ID does not match the
owner of the file, the caller does not have write access to the file, and the caller is not privileged (Linux: does not have either the CAP_DAC_OVERRIDE or the CAP_FOWNER capability).

However, now case02's times is not NULL so that it can only get "EPERM".

So, change case02's times to NULL to reach its expect.

This patch fixes the problem.

---
 testcases/kernel/syscalls/utimes/utimes01.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/utimes/utimes01.c +7 -5
index 390b572..ae2fa2d 100644
@@ -191,8 +191,6 @@ static struct test_case tcase[] = {
         },
         { // case02
                 .ttype          = NORMAL,
-                .a_sec          = 1000,
-                .m_sec          = 2000,
                 .user           = "nobody",
                 .ret            = -1,
                 .err            = EACCES, // RHEL4U1 + 2.6.18 returns EPERM
@@ -270,9 +268,13 @@ static int do_test(struct test_case *tc)
                 const char *dummy = NULL;
                 TEST(sys_ret = utimes(dummy, tv));
         }
-	else
-                TEST(sys_ret = utimes(fpath, tv));
-        sys_errno = errno;
+        else {
+                if (tc->user == NULL)
+                        TEST(sys_ret = utimes(fpath, tv));
+                else
+                        TEST(sys_ret = utimes(fpath, (struct timeval *)NULL));
+        }
+	sys_errno = errno;
         if (tc->ttype == FILE_NOT_EXIST)
                 fpath[len - 1] = c;
         if (sys_ret < 0)

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

#1 lore raw
Quoted 10 lines · liubo

In /testcases/kernel/syscalls/utimes, case02 expects "EACCES" error.

According to utimes's manual,

EACCES times is NULL, the caller’s effective user ID does not match the
owner of the file, the caller does not have write access to the file, and the caller is not privileged (Linux: does not have either the CAP_DAC_OVERRIDE or the CAP_FOWNER capability).

Quoted 7 lines

However, now case02's times is not NULL so that it can only get "EPERM".

So, change case02's times to NULL to reach its expect.

This patch fixes the problem.

Ok. Thanks.

Regards--
Subrata

Quoted 37 lines
---
 testcases/kernel/syscalls/utimes/utimes01.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
testcases/kernel/syscalls/utimes/utimes01.c +7 -6
index 390b572..ae2fa2d 100644
@@ -191,8 +191,6 @@ static struct test_case tcase[] = {
         },
         { // case02
                 .ttype          = NORMAL,
-                .a_sec          = 1000,
-                .m_sec          = 2000,
                 .user           = "nobody",
                 .ret            = -1,
                 .err            = EACCES, // RHEL4U1 + 2.6.18 returns EPERM
@@ -270,9 +268,13 @@ static int do_test(struct test_case *tc)
                 const char *dummy = NULL;
                 TEST(sys_ret = utimes(dummy, tv));
         }
-	else
-                TEST(sys_ret = utimes(fpath, tv));
-        sys_errno = errno;
+        else {
+                if (tc->user == NULL)
+                        TEST(sys_ret = utimes(fpath, tv));
+                else
+                        TEST(sys_ret = utimes(fpath, (struct timeval *)NULL));
+        }
+	sys_errno = errno;
         if (tc->ttype == FILE_NOT_EXIST)
                 fpath[len - 1] = c;
         if (sys_ret < 0)
 
------------------------------------------------------------------------------

Come build with us! The BlackBerry(R) Developer Conference in SF, CA

Quoted 8 lines

is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list