]> git.sur5r.net Git - openldap/commitdiff
ITS#7394 ignore WRITEMAP if RDONLY
authorHoward Chu <hyc@symas.com>
Tue, 18 Sep 2012 19:36:54 +0000 (12:36 -0700)
committerHoward Chu <hyc@symas.com>
Tue, 18 Sep 2012 19:36:54 +0000 (12:36 -0700)
libraries/libmdb/mdb.c

index 2c54cbd2e587af27691c93bef7b04fd4f113d629..c0eb6252c25ff0b6022d14f522e7ee24b68d8415 100644 (file)
@@ -3128,6 +3128,10 @@ mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode)
        if (rc)
                goto leave;
 
+       /* silently ignore WRITEMAP if we're only getting read access */
+       if (F_ISSET(flags, MDB_RDONLY) && F_ISSET(flags, MDB_WRITEMAP))
+               flags ^= MDB_WRITEMAP;
+
 #ifdef _WIN32
        if (F_ISSET(flags, MDB_RDONLY)) {
                oflags = GENERIC_READ;