예제 #1
0
파일: util.c 프로젝트: amitay/samba
/**
 A useful function for returning a path in the Samba cache directory.
**/
char *lpcfg_cache_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
		       const char *name)
{
	char *fname, *dname;
	if (name == NULL) {
		return NULL;
	}
	if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
		return talloc_strdup(mem_ctx, name);
	}

	dname = talloc_strdup(mem_ctx, lpcfg_cachedir(lp_ctx));
	trim_string(dname,"","/");

	if (!directory_exist(dname)) {
		mkdir(dname,0755);
	}

	fname = talloc_asprintf(mem_ctx, "%s/%s", dname, name);

	talloc_free(dname);

	return fname;
}
예제 #2
0
파일: util.c 프로젝트: g1z2yong/samba4
/**
 A useful function for returning a path in the Samba cache directory.
**/
char *lpcfg_cache_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx,
		       const char *name)
{
	return lpcfg_common_path(mem_ctx, lpcfg_cachedir(lp_ctx), name);
}