Exemplo n.º 1
0
static void copy_resources(void)
{
	unsigned int i;

	for (i = 0; tst_test->resource_files[i]; i++)
		TST_RESOURCE_COPY(NULL, tst_test->resource_files[i], NULL);
}
Exemplo n.º 2
0
static void setup(char *app)
{
	tst_sig(FORK, DEF_HANDLER, cleanup);

	tst_tmpdir();

	TST_RESOURCE_COPY(cleanup, TEST_APP, NULL);
	
	TST_CHECKPOINT_INIT(&checkpoint);

	TEST_PAUSE;
}
Exemplo n.º 3
0
Arquivo: mount03.c Projeto: kraj/ltp
static void setup(void)
{
	char path[PATH_MAX];
	struct stat file_stat;

	tst_sig(FORK, DEF_HANDLER, cleanup);

	tst_require_root();

	tst_tmpdir();

	fs_type = tst_dev_fs_type();
	device = tst_acquire_device(cleanup);

	if (!device)
		tst_brkm(TCONF, cleanup, "Failed to obtain block device");

	tst_mkfs(cleanup, device, fs_type, NULL, NULL);

	SAFE_MKDIR(cleanup, mntpoint, DIR_MODE);

	if (getcwd(path_name, sizeof(path_name)) == NULL)
		tst_brkm(TBROK, cleanup, "getcwd failed");

	if (chmod(path_name, DIR_MODE) != 0)
		tst_brkm(TBROK, cleanup, "chmod(%s, %#o) failed",
			 path_name, DIR_MODE);

	strncpy(path, path_name, PATH_MAX);
	snprintf(path_name, PATH_MAX, "%s/%s/", path, mntpoint);

	SAFE_MOUNT(cleanup, device, mntpoint, fs_type, 0, NULL);
	TST_RESOURCE_COPY(cleanup, "mount03_setuid_test", path_name);

	snprintf(file, PATH_MAX, "%smount03_setuid_test", path_name);
	SAFE_STAT(cleanup, file, &file_stat);

	if (file_stat.st_mode != SUID_MODE &&
	    chmod(file, SUID_MODE) < 0)
		tst_brkm(TBROK, cleanup,
			 "setuid for setuid_test failed");
	SAFE_UMOUNT(cleanup, mntpoint);

	TEST_PAUSE;
}