summaryrefslogtreecommitdiff
path: root/ctdb/common/ctdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctdb/common/ctdb.c')
-rw-r--r--ctdb/common/ctdb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ctdb/common/ctdb.c b/ctdb/common/ctdb.c
index 691d0b30628..a017c3df8e8 100644
--- a/ctdb/common/ctdb.c
+++ b/ctdb/common/ctdb.c
@@ -78,7 +78,11 @@ void ctdb_set_max_lacount(struct ctdb_context *ctdb, unsigned count)
*/
int ctdb_set_tdb_dir(struct ctdb_context *ctdb, const char *dir)
{
- ctdb->db_directory = talloc_strdup(ctdb, dir);
+ if (dir == NULL) {
+ ctdb->db_directory = talloc_asprintf(ctdb, "ctdb-%u", ctdb_get_vnn(ctdb));
+ } else {
+ ctdb->db_directory = talloc_strdup(ctdb, dir);
+ }
if (ctdb->db_directory == NULL) {
return -1;
}