v3-4-ctdb: fail db_open_ctdb if ctdb is not around
authorVolker Lendecke <vl@samba.org>
Fri, 6 Aug 2010 10:32:30 +0000 (12:32 +0200)
committerVolker Lendecke <vl@samba.org>
Fri, 6 Aug 2010 10:34:31 +0000 (12:34 +0200)
source3/lib/dbwrap_ctdb.c

index 329d63c5a5e5ccb14729b9b43b287198b9a8c4c0..6887575d44059339768577259b3cd171c5fd63e5 100644 (file)
@@ -1295,6 +1295,11 @@ struct db_context *db_open_ctdb(TALLOC_CTX *mem_ctx,
        db_ctdb->db = result;
 
        conn = messaging_ctdbd_connection();
+       if (conn == NULL) {
+               DEBUG(1, ("Could not connect to ctdb\n"));
+               TALLOC_FREE(result);
+               return NULL;
+       }
 
        if (!NT_STATUS_IS_OK(ctdbd_db_attach(conn, name, &db_ctdb->db_id, tdb_flags))) {
                DEBUG(0, ("ctdbd_db_attach failed for %s\n", name));