summaryrefslogtreecommitdiff
path: root/zen/file_io.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'zen/file_io.cpp')
-rw-r--r--zen/file_io.cpp11
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();
}
bgstack15