diff options
author | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:32:07 +0100 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:32:07 +0100 |
commit | ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252 (patch) | |
tree | 576b1741351e1cd34f0fcce49f98df9c17e10912 /zen/file_io.cpp | |
parent | 7.6 (diff) | |
download | FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.tar.gz FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.tar.bz2 FreeFileSync-ce3574cf7ff2ee68608b4d001f5a6dd1e36b2252.zip |
7.7
Diffstat (limited to 'zen/file_io.cpp')
-rw-r--r-- | zen/file_io.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/zen/file_io.cpp b/zen/file_io.cpp index 5e8b7a1d..b385ce33 100644 --- a/zen/file_io.cpp +++ b/zen/file_io.cpp @@ -79,11 +79,11 @@ FileInput::FileInput(const Zstring& filepath) : //throw FileError, ErrorFileLock auto createHandle = [&](DWORD dwShareMode) { return ::CreateFile(applyLongPathPrefix(filepath).c_str(), //_In_ LPCTSTR lpFileName, - GENERIC_READ, //_In_ DWORD dwDesiredAccess, - dwShareMode, //_In_ DWORD dwShareMode, - nullptr, //_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, - OPEN_EXISTING, //_In_ DWORD dwCreationDisposition, - FILE_FLAG_SEQUENTIAL_SCAN //_In_ DWORD dwFlagsAndAttributes, + GENERIC_READ, //_In_ DWORD dwDesiredAccess, + dwShareMode, //_In_ DWORD dwShareMode, + nullptr, //_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, + OPEN_EXISTING, //_In_ DWORD dwCreationDisposition, + FILE_FLAG_SEQUENTIAL_SCAN | //_In_ DWORD dwFlagsAndAttributes, /* possible values: (Reference http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx#caching_behavior) FILE_FLAG_NO_BUFFERING FILE_FLAG_RANDOM_ACCESS @@ -108,7 +108,7 @@ FileInput::FileInput(const Zstring& filepath) : //throw FileError, ErrorFileLock for FFS most comparisons are probably between different disks => let's use FILE_FLAG_SEQUENTIAL_SCAN */ - | FILE_FLAG_BACKUP_SEMANTICS, + FILE_FLAG_BACKUP_SEMANTICS, nullptr); //_In_opt_ HANDLE hTemplateFile }; fileHandle = createHandle(FILE_SHARE_READ | FILE_SHARE_DELETE); @@ -249,8 +249,8 @@ FileOutput::FileOutput(const Zstring& filepath, AccessFlag access) : //throw Fil nullptr, //_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, dwCreationDisposition, //_In_ DWORD dwCreationDisposition, dwFlagsAndAttributes | - FILE_FLAG_SEQUENTIAL_SCAN //_In_ DWORD dwFlagsAndAttributes, - | FILE_FLAG_BACKUP_SEMANTICS, + FILE_FLAG_SEQUENTIAL_SCAN | //_In_ DWORD dwFlagsAndAttributes, + FILE_FLAG_BACKUP_SEMANTICS, nullptr); //_In_opt_ HANDLE hTemplateFile }; @@ -298,7 +298,7 @@ FileOutput::FileOutput(const Zstring& filepath, AccessFlag access) : //throw Fil //checkForUnsupportedType(filepath); -> not needed, open() + O_WRONLY should fail fast fileHandle = ::open(filepath.c_str(), O_WRONLY | O_CREAT | (access == FileOutput::ACC_CREATE_NEW ? O_EXCL : O_TRUNC), - S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); + S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); //0666 if (fileHandle == -1) { const int ec = errno; //copy before making other system calls! |