All of lore.kernel.org
 help / color / mirror / Atom feed
From: liubo <liubo-fnst@cn.fujitsu.com>
To: ltp-list@lists.sourceforge.net
Subject: [LTP] [PATCH] utimes: fix failure of utimes01
Date: Tue, 13 Oct 2009 17:29:45 +0800	[thread overview]
Message-ID: <4AD44889.7000406@cn.fujitsu.com> (raw)

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

             reply	other threads:[~2009-10-13  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-13  9:29 liubo [this message]
2009-10-13 10:50 ` [LTP] [PATCH] utimes: fix failure of utimes01 Subrata Modak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4AD44889.7000406@cn.fujitsu.com \
    --to=liubo-fnst@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.