Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,15 @@ jobs:
config-output: APU_HAVE_CRYPTO APU_HAVE_OPENSSL APU_HAVE_SDBM
notest-cflags: -Werror
os: ubuntu-latest
- name: APR 1.7.x LDAP+DB+OpenSSL, Ubuntu 20.04
- name: APR 1.7.x LDAP+DB+OpenSSL
apr-version: 1.7.x
apr-config: --enable-maintainer-mode
config: >-
--with-crypto=yes --with-openssl=yes --with-ldap
--with-dbm=db5 --with-berkeley-db --with-gdbm --with-ndbm
config-output: APU_HAVE_CRYPTO APU_HAVE_OPENSSL APU_HAVE_SDBM
notest-cflags: -Werror
os: ubuntu-20.04
os: ubuntu-latest
packages: libdb5.3-dev libldap-dev libsasl2-dev
runs-on: ${{ matrix.os }}
env:
Expand Down
9 changes: 5 additions & 4 deletions dbm/apr_dbm_lmdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

/* --------------------------------------------------------------------------
**
Expand Down Expand Up @@ -98,13 +96,13 @@ static apr_status_t vt_lmdb_open(apr_dbm_t **pdb, const char *pathname,
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;
Expand All @@ -124,14 +122,17 @@ static apr_status_t vt_lmdb_open(apr_dbm_t **pdb, const char *pathname,
}

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 */
Expand Down