All of lore.kernel.org
 help / color / mirror / Atom feed
* [LTP] [PATCH] utimes: fix failure of utimes01
@ 2009-10-13  9:29 liubo
  2009-10-13 10:50 ` Subrata Modak
  0 siblings, 1 reply; 2+ messages in thread
From: liubo @ 2009-10-13  9:29 UTC (permalink / raw)
  To: ltp-list

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.

Signed-off-by: Liu Bo <liubo-fnst@cn.fujitsu.com>
---
 testcases/kernel/syscalls/utimes/utimes01.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/testcases/kernel/syscalls/utimes/utimes01.c b/testcases/kernel/syscalls/utimes/utimes01.c
index 390b572..ae2fa2d 100644
--- a/testcases/kernel/syscalls/utimes/utimes01.c
+++ b/testcases/kernel/syscalls/utimes/utimes01.c
@@ -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
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-10-13 10:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-13  9:29 [LTP] [PATCH] utimes: fix failure of utimes01 liubo
2009-10-13 10:50 ` Subrata Modak

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.