svn commit: r1928977 - apr/apr-util/branches/1.7.x/dbm

[email protected] Mon, 06 Oct 2025 13:15:32 -0000
Newsgroups gmane.comp.apache.apr.cvs
Message-ID <175975653270.806232.14894386107190870774@svn02-us-east.apache.org>
Author: jfclere
Date: Mon Oct  6 13:15:32 2025
New Revision: 1928977

Log:
backport r1928729
merge: https://github.com/apache/apr-util/pull/14

Modified:
   apr/apr-util/branches/1.7.x/dbm/apr_dbm_lmdb.c

Modified: apr/apr-util/branches/1.7.x/dbm/apr_dbm_lmdb.c
==============================================================================
--- apr/apr-util/branches/1.7.x/dbm/apr_dbm_lmdb.c	Mon Oct  6 12:45:02 2025	(r1928976)
+++ apr/apr-util/branches/1.7.x/dbm/apr_dbm_lmdb.c	Mon Oct  6 13:15:32 2025	(r1928977)
@@ -41,8 +41,6 @@ typedef struct {
 
 #define APR_DBM_LMDBMODE_RO       MDB_RDONLY
 #define APR_DBM_LMDBMODE_RWCREATE MDB_CREATE
-#define APR_DBM_LMDBMODE_RW       (MDB_RDONLY + MDB_CREATE + 1)
-#define APR_DBM_LMDBMODE_RWTRUNC  (APR_DBM_LMDBMODE_RW + 1)
 
 /* --------------------------------------------------------------------------
 **
@@ -98,13 +96,13 @@ static apr_status_t vt_lmdb_open(apr_dbm
         dbmode = APR_DBM_LMDBMODE_RO;
         break;
     case APR_DBM_READWRITE:
-        dbmode = APR_DBM_LMDBMODE_RW;
+        dbmode = 0;
         break;
     case APR_DBM_RWCREATE:
         dbi_open_flags = APR_DBM_LMDBMODE_RWCREATE;
         break;
     case APR_DBM_RWTRUNC:
-        truncate = APR_DBM_LMDBMODE_RWTRUNC;
+        truncate = 1;
         break;
     default:
         return APR_EINVAL;
@@ -124,14 +122,17 @@ static apr_status_t vt_lmdb_open(apr_dbm
         }
 
         if (dberr == 0) {
+            /* we pass MDB_RDONLY and the default */
             dberr = mdb_env_open(file.env, pathname, dbmode | DEFAULT_ENV_FLAGS, apr_posix_perms2mode(perm));
         }
 
         if (dberr == 0) {
+            /* we pass MDB_RDONLY */
             dberr = mdb_txn_begin(file.env, NULL, dbmode, &file.txn);
         }
 
         if (dberr == 0) {
+            /* we pass the DB_CREATE */
             dberr = mdb_dbi_open(file.txn, NULL, dbi_open_flags, &file.dbi);
 
             /* if mode == APR_DBM_RWTRUNC, drop database */