projects
/
platform
/
upstream
/
lmdb.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bfe297d
)
ITS#7956 fix compact of empty env
author
Howard Chu
<hyc@symas.com>
Thu, 2 Oct 2014 21:11:43 +0000
(22:11 +0100)
committer
Howard Chu
<hyc@symas.com>
Thu, 2 Oct 2014 21:11:43 +0000
(22:11 +0100)
libraries/liblmdb/mdb.c
patch
|
blob
|
history
diff --git
a/libraries/liblmdb/mdb.c
b/libraries/liblmdb/mdb.c
index
6a9fd97
..
3a86b57
100644
(file)
--- a/
libraries/liblmdb/mdb.c
+++ b/
libraries/liblmdb/mdb.c
@@
-8618,8
+8618,12
@@
mdb_env_copyfd1(MDB_env *env, HANDLE fd)
/* Set metapage 1 */
mm->mm_last_pg = txn->mt_next_pgno - freecount - 1;
mm->mm_dbs[1] = txn->mt_dbs[1];
- mm->mm_dbs[1].md_root = mm->mm_last_pg;
- mm->mm_txnid = 1;
+ if (mm->mm_last_pg > 1) {
+ mm->mm_dbs[1].md_root = mm->mm_last_pg;
+ mm->mm_txnid = 1;
+ } else {
+ mm->mm_dbs[1].md_root = P_INVALID;
+ }
}
my.mc_wlen[0] = env->me_psize * 2;
my.mc_txn = txn;