Use header when some fields are unspecified

vmware
Howard Chu 14 years ago
parent d620d4368a
commit 0c2610ebdd
  1. 6
      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 (size == env->me_head.mh_psize) { /* there is only the header */
if (p_next != NULL) if (p_next != NULL)
*p_next = 1; *p_next = 1;
env->me_meta.mm_stat.ms_psize = env->me_head.mh_psize;
return MDB_SUCCESS; /* new file */ return MDB_SUCCESS; /* new file */
} }
@ -846,8 +847,6 @@ mdbenv_create(MDB_env **env, size_t size)
{ {
MDB_env *e; MDB_env *e;
if (!size) return EINVAL;
e = calloc(1, sizeof(*e)); e = calloc(1, sizeof(*e));
if (!e) return ENOMEM; if (!e) return ENOMEM;
@ -879,6 +878,9 @@ mdbenv_open2(MDB_env *env, unsigned int flags)
newenv = 1; newenv = 1;
} }
if (!env->me_mapsize)
env->me_mapsize = env->me_head.mh_mapsize;
i = MAP_SHARED; i = MAP_SHARED;
if (env->me_head.mh_address && (flags & MDB_FIXEDMAP)) if (env->me_head.mh_address && (flags & MDB_FIXEDMAP))
i |= MAP_FIXED; i |= MAP_FIXED;

Loading…
Cancel
Save