diff options
author | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-03-15 19:25:47 +0000 |
---|---|---|
committer | Michael J. Spencer <bigcheesegs@gmail.com> | 2013-03-15 19:25:47 +0000 |
commit | 1f81ebcbae0a319a9a62c3a29b4519e4ea40333e (patch) | |
tree | 07e69d4640a7dc415ea8e614c47cb8f1e9436229 | |
parent | 5193e4ebe216dd5a07ab9cc58d40de5aafaa990c (diff) |
[Support][Path][Windows] Fix dangling else. Don't call CloseHandle when CloseFD is false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177175 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Support/Windows/PathV2.inc | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/Support/Windows/PathV2.inc b/lib/Support/Windows/PathV2.inc index 0f657bf3b9..23f3d14f91 100644 --- a/lib/Support/Windows/PathV2.inc +++ b/lib/Support/Windows/PathV2.inc @@ -715,10 +715,10 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { FileDescriptor = FD; // Make sure that the requested size fits within SIZE_T. if (Size > std::numeric_limits<SIZE_T>::max()) { - if (FileDescriptor) + if (FileDescriptor) { if (CloseFD) _close(FileDescriptor); - else + } else ::CloseHandle(FileHandle); return make_error_code(errc::invalid_argument); } @@ -739,10 +739,10 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { 0); if (FileMappingHandle == NULL) { error_code ec = windows_error(GetLastError()); - if (FileDescriptor) + if (FileDescriptor) { if (CloseFD) _close(FileDescriptor); - else + } else ::CloseHandle(FileHandle); return ec; } @@ -762,10 +762,10 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { if (Mapping == NULL) { error_code ec = windows_error(GetLastError()); ::CloseHandle(FileMappingHandle); - if (FileDescriptor) + if (FileDescriptor) { if (CloseFD) _close(FileDescriptor); - else + } else ::CloseHandle(FileHandle); return ec; } @@ -777,10 +777,10 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { error_code ec = windows_error(GetLastError()); ::UnmapViewOfFile(Mapping); ::CloseHandle(FileMappingHandle); - if (FileDescriptor) + if (FileDescriptor) { if (CloseFD) _close(FileDescriptor); - else + } else ::CloseHandle(FileHandle); return ec; } @@ -790,10 +790,10 @@ error_code mapped_file_region::init(int FD, bool CloseFD, uint64_t Offset) { // Close all the handles except for the view. It will keep the other handles // alive. ::CloseHandle(FileMappingHandle); - if (FileDescriptor) + if (FileDescriptor) { if (CloseFD) _close(FileDescriptor); // Also closes FileHandle. - else + } else ::CloseHandle(FileHandle); return error_code::success(); } |