From: Howard Chu Date: Tue, 28 Jun 2011 07:15:15 +0000 (-0700) Subject: Use header when some fields are unspecified X-Git-Tag: OPENLDAP_REL_ENG_2_4_27~148^2~187 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=0c2610ebdd8c064edd381ccaeaacb1d69bc6bcf2;p=openldap Use header when some fields are unspecified --- diff --git a/libraries/libmdb/mdb.c b/libraries/libmdb/mdb.c index 4b27da3ab2..63ef4c6a0f 100644 --- a/libraries/libmdb/mdb.c +++ b/libraries/libmdb/mdb.c @@ -782,6 +782,7 @@ mdbenv_read_meta(MDB_env *env, pgno_t *p_next) if (size == env->me_head.mh_psize) { /* there is only the header */ if (p_next != NULL) *p_next = 1; + env->me_meta.mm_stat.ms_psize = env->me_head.mh_psize; return MDB_SUCCESS; /* new file */ } @@ -846,8 +847,6 @@ mdbenv_create(MDB_env **env, size_t size) { MDB_env *e; - if (!size) return EINVAL; - e = calloc(1, sizeof(*e)); if (!e) return ENOMEM; @@ -879,6 +878,9 @@ mdbenv_open2(MDB_env *env, unsigned int flags) newenv = 1; } + if (!env->me_mapsize) + env->me_mapsize = env->me_head.mh_mapsize; + i = MAP_SHARED; if (env->me_head.mh_address && (flags & MDB_FIXEDMAP)) i |= MAP_FIXED;