You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.6 KiB
43 lines
1.6 KiB
|
24 years ago
|
diff -Naur postfix-1.1.11.orig/src/util/dict_db.c postfix-1.1.11/src/util/dict_db.c
|
||
|
|
--- postfix-1.1.11.orig/src/util/dict_db.c Mon Oct 14 18:54:26 2002
|
||
|
|
+++ postfix-1.1.11/src/util/dict_db.c Mon Oct 14 19:14:12 2002
|
||
|
|
@@ -429,6 +429,10 @@
|
||
|
|
struct stat st;
|
||
|
|
DB *db;
|
||
|
|
char *db_path;
|
||
|
|
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
|
||
|
|
+ DB_TXN *db_txnp = NULL;
|
||
|
|
+ static DB_ENV *db_env = NULL;
|
||
|
|
+#endif
|
||
|
|
int lock_fd = -1;
|
||
|
|
int dbfd;
|
||
|
|
|
||
|
|
@@ -512,7 +516,7 @@
|
||
|
|
db_flags |= DB_CREATE;
|
||
|
|
if (open_flags & O_TRUNC)
|
||
|
|
db_flags |= DB_TRUNCATE;
|
||
|
|
- if ((errno = db_create(&db, 0, 0)) != 0)
|
||
|
|
+ if ((errno = db_create(&db, db_env, 0)) != 0)
|
||
|
|
msg_fatal("create DB database: %m");
|
||
|
|
if (db == 0)
|
||
|
|
msg_panic("db_create null result");
|
||
|
|
@@ -520,10 +524,18 @@
|
||
|
|
msg_fatal("set DB cache size %d: %m", DICT_DB_CACHE_SIZE);
|
||
|
|
if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
|
||
|
|
msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
|
||
|
|
+
|
||
|
|
+#if (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 1)
|
||
|
|
+ if ((errno = db_env->txn_begin(db_env, NULL, &db_txnp, 0)) != 0)
|
||
|
|
+ msg_fatal("begin transaction failed: %m");
|
||
|
|
+ if ((errno = db->open(db, db_txnp, db_path, 0, type, db_flags, 0644)) != 0)
|
||
|
|
+ msg_fatal("open database %s: %m", db_path);
|
||
|
|
+#else
|
||
|
|
if ((errno = db->open(db, db_path, 0, type, db_flags, 0644)) != 0)
|
||
|
|
msg_fatal("open database %s: %m", db_path);
|
||
|
|
if ((errno = db->fd(db, &dbfd)) != 0)
|
||
|
|
msg_fatal("get database file descriptor: %m");
|
||
|
|
+#endif
|
||
|
|
#endif
|
||
|
|
if (dict_flags & DICT_FLAG_LOCK) {
|
||
|
|
if (myflock(lock_fd, INTERNAL_LOCK, MYFLOCK_OP_NONE) < 0)
|