public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Subrata Modak <subrata@linux.vnet.ibm.com>
To: Wei Yongjun <yjwei@cn.fujitsu.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] fchmod05: fix to the group ownership and	the	effective user
Date: Tue, 16 Jun 2009 00:46:34 +0530	[thread overview]
Message-ID: <1245093394.4871.51.camel@subratamodak.linux.ibm.com> (raw)
In-Reply-To: <4A3085B9.40707@cn.fujitsu.com>

On Thu, 2009-06-11 at 12:19 +0800, Wei Yongjun wrote: 
> This patch fixed the modify of the group ownership before
> do dir chmod and fixed the effective user when do cleanup.
> Those problems cause the test failed with the following
> error message:
> 
>   fchmod05    1  FAIL  :  testdir: Incorrect modes 043777, Expected 0777
>   fchmod05    0  WARN  :  tst_rmdir(): rmobj(/tmp/fchUout8n) failed: \
>     remove(/tmp/fchUout8n) failed; errno=1: Operation not permitted
> 
> Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>

Thanks.

Regards--
Subrata

> ---
>  testcases/kernel/syscalls/fchmod/fchmod05.c |   13 ++++++++-----
>  1 files changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/testcases/kernel/syscalls/fchmod/fchmod05.c b/testcases/kernel/syscalls/fchmod/fchmod05.c
> index 3573f65..5226858 100644
> --- a/testcases/kernel/syscalls/fchmod/fchmod05.c
> +++ b/testcases/kernel/syscalls/fchmod/fchmod05.c
> @@ -154,10 +154,10 @@ int main(int ac, char **av)
>  			if ((PERMS & ~S_ISGID) != dir_mode) {
>  				tst_resm(TFAIL, "%s: Incorrect modes 0%03o, "
>  					 "Expected 0%03o",
> -					 TESTDIR, PERMS, MODE_RWX);
> +					 TESTDIR, dir_mode, PERMS & ~S_ISGID);
>  			} else {
>  				tst_resm(TPASS, "Functionality of fchmod(%d, "
> -					 "%#o) successful", fd, PERMS);
> +					 "%#o) successful", fd, PERMS & ~S_ISGID);
>  			}
>  		} else {
>  			tst_resm(TPASS, "call succeeded");
> @@ -218,12 +218,12 @@ void setup()
>  		tst_brkm(TBROK, cleanup, "mkdir(2) of %s failed", TESTDIR);
>  	}
> 
> -	if (chown(TESTDIR, nobody_u->pw_uid, bin_group->gr_gid) == -1)
> +	if (chown(TESTDIR, nobody_u->pw_uid, nobody_u->pw_gid) == -1)
>  		tst_brkm(TBROK, cleanup, "Couldn't change owner of testdir: %s",
>  				strerror(errno));
> 
> -	/* change to nobody:nobody */
> -	if (setegid(nobody_u->pw_gid) == -1 || seteuid(nobody_u->pw_uid) == -1)
> +	/* change to nobody:bin */
> +	if (setegid(bin_group->gr_gid) == -1 || seteuid(nobody_u->pw_uid) == -1)
>  		tst_brkm(TBROK, cleanup, "Couldn't switch to nobody:nobody: %s",
>  				strerror(errno));
> 
> @@ -258,6 +258,9 @@ void cleanup()
>  			 TESTDIR, errno, strerror(errno));
>  	}
> 
> +	setegid(0);
> +	seteuid(0);
> +
>  	/* Remove tmp dir and all files in it */
>  	tst_rmdir();
> 


------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing 
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      reply	other threads:[~2009-06-15 19:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11  4:19 [LTP] [PATCH] fchmod05: fix to the group ownership and the effective user Wei Yongjun
2009-06-15 19:16 ` Subrata Modak [this message]

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=1245093394.4871.51.camel@subratamodak.linux.ibm.com \
    --to=subrata@linux.vnet.ibm.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yjwei@cn.fujitsu.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox