Esempio n. 1
0
int main(int ac, char **av)
{
	int lc;
	char *msg;

	gid_t gid;

	if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {
		tst_count = 0;

		gid = getegid();
		GID16_CHECK(gid, setfsgid, cleanup);

		TEST(SETFSGID(cleanup, gid));

		if (TEST_RETURN == -1) {
			tst_resm(TFAIL | TTERRNO,
				"setfsgid() failed unexpectedly");
			continue;
		}

		if (!STD_FUNCTIONAL_TEST) {
			tst_resm(TPASS, "setfsgid() succeeded");
			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);
		}
	}

	cleanup();
	tst_exit();
}
Esempio n. 2
0
int main(int ac, char **av)
{
	int lc;

	gid_t gid;

	tst_parse_opts(ac, av, NULL, NULL);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {
		tst_count = 0;

		gid = 1;
		while (!getgrgid(gid))
			gid++;

		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 anything but %d",
				 TEST_RETURN, gid);
		} else {
			tst_resm(TPASS, "setfsgid() returned expected value : "
				 "%ld", TEST_RETURN);
		}
	}

	cleanup();
	tst_exit();
}