All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Avinesh Kumar <akumar@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH] setfsgid01: Rewrite using new LTP API
Date: Sat, 22 Oct 2022 00:58:39 +0200	[thread overview]
Message-ID: <Y1MkHzCOXZYzomH/@pevik> (raw)
In-Reply-To: <20221012064929.4725-1-akumar@suse.de>

Hi Avinesh,

> Rewrite using new API and add test setfsgid(-1) which will always
> fail but will determine if the preceding setfsgid() call changed
> the filesystem group ID as expected.
+1

Thanks, merged with fix below.

> -		gid = getegid();
> -		GID16_CHECK(gid, setfsgid, cleanup);
> -
> -		TEST(SETFSGID(cleanup, gid));
> -
> -		if (TEST_RETURN == -1) {
> -			tst_resm(TFAIL | TTERRNO,
> -				"setfsgid() failed unexpectedly");
> -			continue;
> -		}
> -
> -		if (TEST_RETURN != gid) {
> -			tst_resm(TFAIL, "setfsgid() returned %ld, expected %d",
> -				 TEST_RETURN, gid);
> -		} else {
> -			tst_resm(TPASS,
> -				"setfsgid() returned expected value : %ld",
> -				TEST_RETURN);
> -		}
> -	}
...
> +	gid = getegid();
> +	GID16_CHECK(gid, setfsgid);

> -static void cleanup(void)
> -{
> +	SAFE_SETEUID(0);
> +	TST_EXP_VAL(setfsgid(nobody_gid), gid);
> +	TST_EXP_VAL(setfsgid(-1), nobody_gid);
> +	TST_EXP_VAL_SILENT(setfsgid(gid), nobody_gid);

NOTE: all of these needed to be SETFSGID(), otherwise setfsgid01_16 would
happily test 32-bit version instead of 16-bit version.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2022-10-21 22:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  6:49 [LTP] [PATCH] setfsgid01: Rewrite using new LTP API Avinesh Kumar
2022-10-21 22:58 ` Petr Vorel [this message]
2022-10-25  6:37   ` Avinesh Kumar

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=Y1MkHzCOXZYzomH/@pevik \
    --to=pvorel@suse.cz \
    --cc=akumar@suse.de \
    --cc=ltp@lists.linux.it \
    /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.