Make sure init_meta is at beginning of file

vmware
Howard Chu 12 years ago
parent ed86a086f7
commit 9acf801cc1
  1. 2
      libraries/liblmdb/mdb.c

@ -2518,10 +2518,12 @@ mdb_env_init_meta(MDB_env *env, MDB_meta *meta)
#ifdef _WIN32 #ifdef _WIN32
{ {
DWORD len; DWORD len;
SetFilePointer(env->me_fd, 0, NULL, FILE_BEGIN);
rc = WriteFile(env->me_fd, p, psize * 2, &len, NULL); rc = WriteFile(env->me_fd, p, psize * 2, &len, NULL);
rc = (len == psize * 2) ? MDB_SUCCESS : ErrCode(); rc = (len == psize * 2) ? MDB_SUCCESS : ErrCode();
} }
#else #else
lseek(env->me_fd, 0, SEEK_SET);
rc = write(env->me_fd, p, psize * 2); rc = write(env->me_fd, p, psize * 2);
rc = (rc == (int)psize * 2) ? MDB_SUCCESS : ErrCode(); rc = (rc == (int)psize * 2) ? MDB_SUCCESS : ErrCode();
#endif #endif

Loading…
Cancel
Save