From 9acf801cc119d187e1252474cab7d228dc6d7676 Mon Sep 17 00:00:00 2001 From: Howard Chu Date: Tue, 11 Dec 2012 12:55:47 -0800 Subject: [PATCH] Make sure init_meta is at beginning of file --- libraries/liblmdb/mdb.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 4492a76030..e6f75406e1 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -2518,10 +2518,12 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta) #ifdef _WIN32 { DWORD len; + SetFilePointer(env->me_fd, 0, NULL, FILE_BEGIN); rc = WriteFile(env->me_fd, p, psize * 2, &len, NULL); rc = (len == psize * 2) ? MDB_SUCCESS : ErrCode(); } #else + lseek(env->me_fd, 0, SEEK_SET); rc = write(env->me_fd, p, psize * 2); rc = (rc == (int)psize * 2) ? MDB_SUCCESS : ErrCode(); #endif -- 2.39.5