summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2009-10-11 01:39:39 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2009-10-11 01:39:39 +0200
commitee895815c8f924a9d54420cca07d2e8dc3ddf9e0 (patch)
tree5ca08e35a2b0466f2f935e7bf62d6f97babae325
parent69a2548913619eb81dcb6c03e27585e02fe057cd (diff)
downloadlibrcc-ee895815c8f924a9d54420cca07d2e8dc3ddf9e0.tar.gz
librcc-ee895815c8f924a9d54420cca07d2e8dc3ddf9e0.tar.bz2
librcc-ee895815c8f924a9d54420cca07d2e8dc3ddf9e0.tar.xz
librcc-ee895815c8f924a9d54420cca07d2e8dc3ddf9e0.zip
Problems with BerkeleyDB 4.7.x
-rw-r--r--.bzrignore4
-rw-r--r--src/rccdb4.c21
2 files changed, 21 insertions, 4 deletions
diff --git a/.bzrignore b/.bzrignore
index ac43524..c27d485 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -33,3 +33,7 @@ ltversion.m4
lt~obsolete.m4
external/rccexternal
stamp-h.in
+example1
+example2
+rcc-gtk-config
+rcc-gtk2-config
diff --git a/src/rccdb4.c b/src/rccdb4.c
index fe7f540..f29f5e3 100644
--- a/src/rccdb4.c
+++ b/src/rccdb4.c
@@ -36,7 +36,7 @@ db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags) {
DB_ENV *dbe;
DB *db;
-# ifndef DB_LOG_AUTOREMOVE
+# if ((!defined(DB_LOG_AUTOREMOVE)) && (!defined(DB_LOG_AUTO_REMOVE)))
# ifdef DB_VERSION_MISMATCH
char stmp[160];
# endif /* DB_VERSION_MISMATCH */
@@ -45,7 +45,7 @@ db4_context rccDb4CreateContext(const char *dbpath, rcc_db4_flags flags) {
err = db_env_create(&dbe, 0);
if (err) return NULL;
-# ifdef DB_LOG_AUTOREMOVE
+# if defined(DB_LOG_AUTOREMOVE)
dbe->set_flags(dbe, DB_LOG_AUTOREMOVE, 1);
dbe->set_lg_max(dbe, 131072);
@@ -54,14 +54,27 @@ 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();
}
+# elif defined(DB_LOG_AUTO_REMOVE)
+ // Starting from berkeleydb 4.7 API has changed
+ dbe->log_set_config(dbe, DB_LOG_AUTO_REMOVE, 1);
+ dbe->set_lg_max(dbe, 131072);
+
+ err = rccLock();
+ if (!err) {
+ err = dbe->open(dbe, dbpath, DB_CREATE|DB_INIT_TXN|DB_USE_ENVIRON|DB_INIT_LOCK|DB_INIT_MPOOL|DB_RECOVER, 00644);
+ rccUnLock();
+ }
# 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()) {
+ 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);
dbe->close(dbe, 0);
- dbe->remove(dbe, dbpath, 0);
+ if (err) {
+ err = db_env_create(&dbe, 0);
+ if (!err) dbe->remove(dbe, dbpath, 0);
+ }
rccUnLock();
} else {
err = -1;