]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
More for rawpart
authorHoward Chu <hyc@openldap.org>
Mon, 7 Apr 2025 15:46:52 +0000 (16:46 +0100)
committerHoward Chu <hyc@openldap.org>
Mon, 7 Apr 2025 15:46:52 +0000 (16:46 +0100)
It was ignoring the mapsize recorded in the meta page, and was
redundantly mapping the meta pages.

libraries/liblmdb/mdb.c

index dd00498322ae205672677d9cf59144cf02216def..1aa721ba262769cbf9e4f01aac19a7b9c8acc43e 100644 (file)
@@ -5373,6 +5373,14 @@ mdb_env_open2(MDB_env *env, int prev)
 #endif
        ;
 
+       /* if RAWPART, we did a preliminary mapping in read_header. drop it now. */
+       if (flags & MDB_RAWPART) {
+               munmap(env->me_map, env->me_mapsize);
+               env->me_map = NULL;
+               /* if mapsize was defaulted, use mapsize from metapage */
+               if (env->me_mapsize == DEFAULT_MAPSIZE)
+                       env->me_mapsize = 0;
+       }
        /* Was a mapsize configured? */
        if (!env->me_mapsize) {
                env->me_mapsize = meta.mm_mapsize;