|
|
@ -3431,10 +3431,17 @@ mdb_env_copy(MDB_env *env, const char *path) |
|
|
|
ptr = env->me_map + wsize; |
|
|
|
ptr = env->me_map + wsize; |
|
|
|
wsize = txn->mt_next_pgno * env->me_psize - wsize; |
|
|
|
wsize = txn->mt_next_pgno * env->me_psize - wsize; |
|
|
|
#ifdef _WIN32 |
|
|
|
#ifdef _WIN32 |
|
|
|
{ |
|
|
|
#define MAX_UINT32 4294967295U |
|
|
|
DWORD len; |
|
|
|
while (wsize > 0) { |
|
|
|
rc = WriteFile(newfd, ptr, wsize, &len, NULL); |
|
|
|
DWORD len, w2; |
|
|
|
rc = (len == wsize) ? MDB_SUCCESS : ErrCode(); |
|
|
|
if (wsize > MAX_UINT32) |
|
|
|
|
|
|
|
w2 = MAX_UINT32 - env->me_psize + 1; /* write in pagesize chunks */ |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
w2 = wsize; |
|
|
|
|
|
|
|
rc = WriteFile(newfd, ptr, w2, &len, NULL); |
|
|
|
|
|
|
|
rc = (len == w2) ? MDB_SUCCESS : ErrCode(); |
|
|
|
|
|
|
|
if (rc) break; |
|
|
|
|
|
|
|
wsize -= w2; |
|
|
|
} |
|
|
|
} |
|
|
|
#else |
|
|
|
#else |
|
|
|
rc = write(newfd, ptr, wsize); |
|
|
|
rc = write(newfd, ptr, wsize); |
|
|
|