#include <stdio.h>
#include <zlib.h>
#include <db.h>
+#include <assert.h>
#include <libcitadel.h>
#include "../../citserver.h"
#include "../../config.h"
// Some functions in this backend need to store some per-thread data.
// This returns the pointer to the current thread's per-thread data block, creating it if necessary.
+// (This will also work in a non-threaded program; it will return the same pointer every time.)
struct bdb_tsd *bdb_get_tsd(void) {
struct bdb_tsd *c = (struct bdb_tsd *) pthread_getspecific(bdb_thread_key) ;
exit(CTDLEXIT_DB);
}
- syslog(LOG_INFO, "bdb: mounting databases");
for (i = 0; i < MAXCDB; ++i) {
+ syslog(LOG_INFO, "bdb: mounting database %02x", i);
ret = db_create(&bdb_table[i], bdb_env, 0); // Create a database handle
if (ret) {
syslog(LOG_ERR, "bdb: db_create: %s", db_strerror(ret));
TSD->dbkey[cdb].flags = DB_DBT_MALLOC;
TSD->dbdata[cdb].flags = DB_DBT_MALLOC;
+ assert(TSD->cursors[cdb] != NULL);
ret = TSD->cursors[cdb]->c_get(TSD->cursors[cdb], &TSD->dbkey[cdb], &TSD->dbdata[cdb], DB_NEXT);
if (ret) {