diff options
Diffstat (limited to 'erts/emulator/drivers/win32/win_efile.c')
-rw-r--r-- | erts/emulator/drivers/win32/win_efile.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/erts/emulator/drivers/win32/win_efile.c b/erts/emulator/drivers/win32/win_efile.c index 319065f57b..d693d7d593 100644 --- a/erts/emulator/drivers/win32/win_efile.c +++ b/erts/emulator/drivers/win32/win_efile.c @@ -698,6 +698,7 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */ HANDLE fd; /* Handle to open file. */ DWORD access; /* Access mode: GENERIC_READ, GENERIC_WRITE. */ DWORD crFlags; + DWORD flagsAndAttrs = FILE_ATTRIBUTE_NORMAL; WCHAR *wname = (WCHAR *) name; switch (flags & (EFILE_MODE_READ|EFILE_MODE_WRITE)) { @@ -719,6 +720,10 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */ return 0; } + if (flags & EFILE_MODE_SYNC) { + flagsAndAttrs = FILE_FLAG_WRITE_THROUGH; + } + if (flags & EFILE_MODE_APPEND) { crFlags = OPEN_ALWAYS; } @@ -727,7 +732,7 @@ efile_openfile(Efile_error* errInfo, /* Where to return error codes. */ } fd = CreateFileW(wname, access, FILE_SHARE_FLAGS, - NULL, crFlags, FILE_ATTRIBUTE_NORMAL, NULL); + NULL, crFlags, flagsAndAttrs, NULL); /* * Check for errors. |