summaryrefslogtreecommitdiff
path: root/source3/lib/dbwrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/dbwrap.c')
-rw-r--r--source3/lib/dbwrap.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/source3/lib/dbwrap.c b/source3/lib/dbwrap.c
index 7fe1631bff..eec15a84bd 100644
--- a/source3/lib/dbwrap.c
+++ b/source3/lib/dbwrap.c
@@ -60,8 +60,15 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
sockname = CTDB_PATH;
}
- if (lp_clustering() && socket_exist(sockname)) {
+ if (lp_clustering()) {
const char *partname;
+
+ if (!socket_exist(sockname)) {
+ DEBUG(1, ("ctdb socket does not exist - is ctdb not "
+ "running?\n"));
+ return NULL;
+ }
+
/* ctdb only wants the file part of the name */
partname = strrchr(name, '/');
if (partname) {
@@ -76,8 +83,7 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx,
if (result == NULL) {
DEBUG(0,("failed to attach to ctdb %s\n",
partname));
- smb_panic("failed to attach to a ctdb "
- "database");
+ return NULL;
}
}
}
@@ -112,7 +118,7 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
if (tdb_flags & TDB_CLEAR_IF_FIRST) {
DEBUG(0,("db_open_trans: called with TDB_CLEAR_IF_FIRST: %s\n",
name));
- smb_panic("db_open_trans: called with TDB_CLEAR_IF_FIRST");
+ return NULL;
}
#ifdef CLUSTER_SUPPORT
@@ -120,8 +126,15 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
sockname = CTDB_PATH;
}
- if (lp_clustering() && socket_exist(sockname)) {
+ if (lp_clustering()) {
const char *partname;
+
+ if (!socket_exist(sockname)) {
+ DEBUG(1, ("ctdb socket does not exist - is ctdb not "
+ "running?\n"));
+ return NULL;
+ }
+
/* ctdb only wants the file part of the name */
partname = strrchr(name, '/');
if (partname) {
@@ -137,8 +150,6 @@ struct db_context *db_open_trans(TALLOC_CTX *mem_ctx,
if (result == NULL) {
DEBUG(0,("failed to attach to ctdb %s\n",
partname));
- smb_panic("failed to attach to a ctdb "
- "database");
}
return result;
}