예제 #1
0
파일: getgid01.c 프로젝트: kraj/ltp
int main(int ac, char **av)
{
	int lc;

	tst_parse_opts(ac, av, NULL, NULL);

	setup();

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

		tst_count = 0;

		TEST(GETGID(cleanup));

		if (TEST_RETURN == -1) {
			tst_resm(TFAIL, "getgid failed");
		} else {
			tst_resm(TPASS, "getgid returned %ld",
				 TEST_RETURN);
		}
	}

	cleanup();
	tst_exit();
}
예제 #2
0
파일: setgid01.c 프로젝트: Nan619/ltp-ddt
/***************************************************************
 * setup() - performs all ONE TIME setup for this test.
 ***************************************************************/
void setup()
{

	tst_sig(NOFORK, DEF_HANDLER, cleanup);

	TEST_PAUSE;

	gid = GETGID();
}
예제 #3
0
파일: getgid03.c 프로젝트: GOEUM/ltp
int main(int ac, char **av)
{
	int lc;
	char *msg;
	uid_t uid;
	struct passwd *pwent;

	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;

		TEST(GETGID(cleanup));

		if (TEST_RETURN < 0) {
			tst_brkm(TBROK, cleanup, "This should never happen");
		}

		if (STD_FUNCTIONAL_TEST) {
			uid = getuid();
			pwent = getpwuid(uid);

			if (pwent == NULL)
				tst_brkm(TBROK, cleanup, "getuid() returned "
					 "unexpected value %d", uid);

			GID16_CHECK(pwent->pw_gid, getgid, cleanup);

			if (pwent->pw_gid != TEST_RETURN) {
				tst_resm(TFAIL, "getgid() return value "
					 "%ld unexpected - expected %d",
					 TEST_RETURN, pwent->pw_gid);
			} else {
				tst_resm(TPASS, "values from getuid "
					 "and getpwuid match");
			}
		} else {
			tst_resm(TPASS, "call succeeded");
		}
	}

	cleanup();
	tst_exit();
}