summaryrefslogtreecommitdiff
path: root/source4/lib/gencache
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-09-07 11:47:03 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:05:25 -0500
commitbd5a802a26f427779663a3de5f6d49f352b7c473 (patch)
tree2910b4e5f23c51147a9d9863276ac7ab017bb21e /source4/lib/gencache
parentac3cbe87c6d492f91c9e18b42191bfc9991a767a (diff)
downloadsamba-bd5a802a26f427779663a3de5f6d49f352b7c473.tar.gz
samba-bd5a802a26f427779663a3de5f6d49f352b7c473.tar.bz2
samba-bd5a802a26f427779663a3de5f6d49f352b7c473.zip
r24992: Remove some uses of lp_*().
(This used to be commit a5a1a5540510cdb1bfbb3e89b84f4ba5b2812c55)
Diffstat (limited to 'source4/lib/gencache')
-rw-r--r--source4/lib/gencache/gencache.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/lib/gencache/gencache.c b/source4/lib/gencache/gencache.c
index a30f09fefa..08ff55b211 100644
--- a/source4/lib/gencache/gencache.c
+++ b/source4/lib/gencache/gencache.c
@@ -50,22 +50,23 @@ static struct tdb_wrap *cache;
BOOL gencache_init(void)
{
char* cache_fname = NULL;
+ TALLOC_CTX *mem_ctx = talloc_autofree_context();
/* skip file open if it's already opened */
if (cache) return True;
- asprintf(&cache_fname, "%s/%s", lp_lockdir(), "gencache.tdb");
- if (cache_fname)
+ cache_fname = lock_path(mem_ctx, "gencache.tdb");
+ if (cache_fname != NULL) {
DEBUG(5, ("Opening cache file at %s\n", cache_fname));
- else {
+ } else {
DEBUG(0, ("Filename allocation failed.\n"));
- return False;
+ return false;
}
- cache = tdb_wrap_open(NULL, cache_fname, 0, TDB_DEFAULT,
+ cache = tdb_wrap_open(mem_ctx, cache_fname, 0, TDB_DEFAULT,
O_RDWR|O_CREAT, 0644);
- SAFE_FREE(cache_fname);
+ talloc_free(cache_fname);
if (!cache) {
DEBUG(5, ("Attempt to open gencache.tdb has failed.\n"));
return False;