summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rccdb4.c14
-rw-r--r--src/rccexternal.h2
2 files changed, 11 insertions, 5 deletions
diff --git a/src/rccdb4.c b/src/rccdb4.c
index 1eb5d44..d21f36b 100644
--- a/src/rccdb4.c
+++ b/src/rccdb4.c
@@ -17,14 +17,16 @@ db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags) {
DB_ENV *dbe;
DB *db;
-# if 0
+# ifndef DB_LOG_AUTOREMOVE
+# ifdef DB_VERSION_MISMATCH
char stmp[160];
-# endif
+# endif /* DB_VERSION_MISMATCH */
+# endif /* DB_LOG_AUTOREMOVE */
err = db_env_create(&dbe, 0);
if (err) return NULL;
-# if 1
+# ifdef DB_LOG_AUTOREMOVE
dbe->set_flags(dbe, DB_LOG_AUTOREMOVE, 1);
dbe->set_lg_max(dbe, 131072);
@@ -33,8 +35,9 @@ db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags) {
err = dbe->open(dbe, dbpath, DB_CREATE|DB_INIT_TXN|DB_USE_ENVIRON|DB_INIT_LOCK|DB_INIT_MPOOL|DB_RECOVER, 00644);
rccUnLock();
}
-# else
+# else /* DB_LOG_AUTOREMOVE */
err = dbe->open(dbe, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 00644);
+# ifdef DB_VERSION_MISMATCH
if (err == DB_VERSION_MISMATCH) {
if (!rccLock()) {
err = dbe->open(dbe, dbpath, DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_MPOOL|DB_INIT_TXN|DB_USE_ENVIRON|DB_PRIVATE|DB_RECOVER, 0);
@@ -59,7 +62,8 @@ db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags) {
err = dbe->open(dbe, dbpath, DB_CREATE|DB_INIT_CDB|DB_INIT_MPOOL, 00644);
}
-# endif
+# endif /* DB_VERSION_MISMATCH */
+# endif /* DB_LOG_AUTOREMOVE */
if (err) {
// fprintf(stderr, "BerkelyDB initialization failed: %i (%s)\n", err, db_strerror(err));
diff --git a/src/rccexternal.h b/src/rccexternal.h
index 1038329..181a6ec 100644
--- a/src/rccexternal.h
+++ b/src/rccexternal.h
@@ -1,6 +1,8 @@
#ifndef _RCC_EXTERNAL_H
#define _RCC_EXTERNAL_H
+#include "../config.h"
+
typedef enum rcc_external_module_t {
RCC_EXTERNAL_MODULE_CONTROL = 0,
RCC_EXTERNAL_MODULE_OPTIONS,