diff options
author | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:31:24 +0100 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2016-03-16 21:31:24 +0100 |
commit | 89621addb4a7c87d2e3f3e7462e3c690cf71de71 (patch) | |
tree | 008b5dea7624ee1eeb57ff82c45fdf1afcab3b08 /zen/file_io.cpp | |
parent | 7.5 (diff) | |
download | FreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.tar.gz FreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.tar.bz2 FreeFileSync-89621addb4a7c87d2e3f3e7462e3c690cf71de71.zip |
7.6
Diffstat (limited to 'zen/file_io.cpp')
-rw-r--r-- | zen/file_io.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/zen/file_io.cpp b/zen/file_io.cpp index 68e852da..5e8b7a1d 100644 --- a/zen/file_io.cpp +++ b/zen/file_io.cpp @@ -150,14 +150,11 @@ FileInput::FileInput(const Zstring& filepath) : //throw FileError, ErrorFileLock //------------------------------------------------------------------------------------------------------ - ScopeGuard constructorGuard = zen::makeGuard([&] //destructor call would lead to member double clean-up!!! - { -#ifdef ZEN_WIN - ::CloseHandle(fileHandle); +#ifdef ZEN_WIN //destructor call would lead to member double clean-up!!! + ZEN_ON_SCOPE_FAIL(::CloseHandle(fileHandle)); #elif defined ZEN_LINUX || defined ZEN_MAC - ::close(fileHandle); + ZEN_ON_SCOPE_FAIL(::close(fileHandle)); #endif - }); #ifdef ZEN_LINUX //handle still un-owned => need constructor guard //optimize read-ahead on input file: @@ -167,8 +164,6 @@ FileInput::FileInput(const Zstring& filepath) : //throw FileError, ErrorFileLock #elif defined ZEN_MAC //"dtruss" doesn't show use of "fcntl() F_RDAHEAD/F_RDADVISE" for "cp") #endif - - constructorGuard.dismiss(); } |