aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers
diff options
context:
space:
mode:
authorPatrik Nyblom <[email protected]>2010-11-29 13:55:21 +0100
committerPatrik Nyblom <[email protected]>2010-11-29 13:55:32 +0100
commit9d4fd926cb881dad5c15da4f63969ca72fe1dc98 (patch)
tree33a587a601e8db33399e66bdf7ce93637eec304d /erts/emulator/drivers
parent0502c8f7726b531e909545952968962d462c19c4 (diff)
parent6aae43917d587be7f631673d1e1963fbb2ba15e1 (diff)
downloadotp-9d4fd926cb881dad5c15da4f63969ca72fe1dc98.tar.gz
otp-9d4fd926cb881dad5c15da4f63969ca72fe1dc98.tar.bz2
otp-9d4fd926cb881dad5c15da4f63969ca72fe1dc98.zip
Merge branch 'jr/windows-file-append' into dev
* jr/windows-file-append: Fix appending to large files (>4GB) on Windows OTP-8958
Diffstat (limited to 'erts/emulator/drivers')
-rwxr-xr-xerts/emulator/drivers/win32/win_efile.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c
index 88dd42b42a..6de08e2fa6 100755
--- a/erts/emulator/drivers/win32/win_efile.c
+++ b/erts/emulator/drivers/win32/win_efile.c
@@ -1112,12 +1112,17 @@ char* buf; /* Buffer to write. */
size_t count; /* Number of bytes to write. */
{
DWORD written; /* Bytes written in last operation. */
+ OVERLAPPED overlapped;
+ OVERLAPPED* pOverlapped = NULL;
if (flags & EFILE_MODE_APPEND) {
- (void) SetFilePointer((HANDLE) fd, 0, NULL, FILE_END);
+ memset(&overlapped, 0, sizeof(overlapped));
+ overlapped.Offset = 0xffffffff;
+ overlapped.OffsetHigh = 0xffffffff;
+ pOverlapped = &overlapped;
}
while (count > 0) {
- if (!WriteFile((HANDLE) fd, buf, count, &written, NULL))
+ if (!WriteFile((HANDLE) fd, buf, count, &written, pOverlapped))
return set_error(errInfo);
buf += written;
count -= written;
@@ -1137,11 +1142,16 @@ efile_writev(Efile_error* errInfo, /* Where to return error codes */
size_t size) /* Number of bytes to write */
{
int cnt; /* Buffers so far written */
+ OVERLAPPED overlapped;
+ OVERLAPPED* pOverlapped = NULL;
ASSERT(iovcnt >= 0);
if (flags & EFILE_MODE_APPEND) {
- (void) SetFilePointer((HANDLE) fd, 0, NULL, FILE_END);
+ memset(&overlapped, 0, sizeof(overlapped));
+ overlapped.Offset = 0xffffffff;
+ overlapped.OffsetHigh = 0xffffffff;
+ pOverlapped = &overlapped;
}
for (cnt = 0; cnt < iovcnt; cnt++) {
if (iov[cnt].iov_base && iov[cnt].iov_len > 0) {
@@ -1153,7 +1163,7 @@ efile_writev(Efile_error* errInfo, /* Where to return error codes */
iov[cnt].iov_base + p,
iov[cnt].iov_len - p,
&w,
- NULL))
+ pOverlapped))
return set_error(errInfo);
}
}