OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael Schloh
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   14-Oct-2002 19:57:14
  Branch: HEAD                             Handle: 2002101418571300

  Added files:
    openpkg-src/postfix     postfix-db4.patch

  Log:
    Postfix now conforms to the new transactional API of Berkley db 4.1.24.

  Summary:
    Revision    Changes     Path
    1.1         +42 -0      openpkg-src/postfix/postfix-db4.patch
  ____________________________________________________________________________

  Index: openpkg-src/postfix/postfix-db4.patch
  ============================================================
  $ cvs update -p -r1.1 postfix-db4.patch
  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)
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to