From: Andrew Tridgell Date: Wed, 18 Apr 2007 23:58:23 +0000 (+1000) Subject: - use separate directories for the tdb files by default X-Git-Tag: tevent-0.9.20~348^2~2875 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a3ab61b384c90858df6af52f386daa71025767f4;p=thirdparty%2Fsamba.git - use separate directories for the tdb files by default - use TDB_CLEAR_IF_FIRST to ensure we don't use an old tdb (This used to be ctdb commit ac47d7b4eb79597da1358da21f10e634cdc9dd2e) --- diff --git a/ctdb/common/cmdline.c b/ctdb/common/cmdline.c index 4995cc8de13..07a19cedc57 100644 --- a/ctdb/common/cmdline.c +++ b/ctdb/common/cmdline.c @@ -37,7 +37,7 @@ static struct { .transport = "tcp", .myaddress = NULL, .self_connect = 0, - .db_dir = "." + .db_dir = NULL }; diff --git a/ctdb/common/ctdb_ltdb.c b/ctdb/common/ctdb_ltdb.c index 63a1e22d496..7fb0fe55794 100644 --- a/ctdb/common/ctdb_ltdb.c +++ b/ctdb/common/ctdb_ltdb.c @@ -82,6 +82,13 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, } } + if (mkdir(ctdb->db_directory, 0700) == -1 && errno != EEXIST) { + DEBUG(0,(__location__ " Unable to create ctdb directory '%s'\n", + ctdb->db_directory)); + talloc_free(ctdb_db); + return NULL; + } + /* add the node id to the database name, so when we run on loopback we don't conflict in the local filesystem */ name = talloc_asprintf(ctdb_db, "%s/%s", ctdb->db_directory, name); @@ -89,7 +96,7 @@ struct ctdb_db_context *ctdb_attach(struct ctdb_context *ctdb, const char *name, /* when we have a separate daemon this will need to be a real file, not a TDB_INTERNAL, so the parent can access it to for ltdb bypass */ - ctdb_db->ltdb = tdb_wrap_open(ctdb, name, 0, TDB_DEFAULT, open_flags, mode); + ctdb_db->ltdb = tdb_wrap_open(ctdb, name, 0, TDB_CLEAR_IF_FIRST, open_flags, mode); if (ctdb_db->ltdb == NULL) { ctdb_set_error(ctdb, "Failed to open tdb %s\n", name); talloc_free(ctdb_db);