diff options
Diffstat (limited to 'lib/tdb/common/io.c')
-rw-r--r-- | lib/tdb/common/io.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/tdb/common/io.c b/lib/tdb/common/io.c index 78bbf2ec77..649b70f639 100644 --- a/lib/tdb/common/io.c +++ b/lib/tdb/common/io.c @@ -53,6 +53,14 @@ static int tdb_oob(struct tdb_context *tdb, tdb_off_t len, int probe) return -1; } + /* Unmap, update size, remap */ + if (tdb_munmap(tdb) == -1) { + tdb->ecode = TDB_ERR_IO; + return -1; + } + tdb->map_size = st.st_size; + tdb_mmap(tdb); + if (st.st_size < (size_t)len) { if (!probe) { /* Ensure ecode is set for log fn. */ @@ -63,13 +71,6 @@ static int tdb_oob(struct tdb_context *tdb, tdb_off_t len, int probe) return -1; } - /* Unmap, update size, remap */ - if (tdb_munmap(tdb) == -1) { - tdb->ecode = TDB_ERR_IO; - return -1; - } - tdb->map_size = st.st_size; - tdb_mmap(tdb); return 0; } |