Only fallback to MDB_RDONLY if readonly database is requested
Somewhat similarly to commit 70a1efa52b
,
only allow read-only environment if read-only is requested, writers
are better off failing early.
This commit is contained in:
parent
2822ccbcdf
commit
b052d69474
|
@ -171,7 +171,7 @@ static int db_init(rpmdb rdb, const char * dbhome)
|
|||
eflags |= MDB_MAPASYNC;
|
||||
eflags |= MDB_NOTLS;
|
||||
|
||||
if (access(dbhome, W_OK))
|
||||
if (access(dbhome, W_OK) && (rdb->db_mode & O_ACCMODE) == O_RDONLY)
|
||||
eflags |= MDB_RDONLY;
|
||||
|
||||
rc = mdb_env_open(env, dbhome, eflags, rdb->db_perms);
|
||||
|
|
Loading…
Reference in New Issue