[llvm] r177175 - [Support][Path][Windows] Fix dangling else. Don't call CloseHandle when CloseFD is false.
Michael J. Spencer
bigcheesegs at gmail.com
Fri Mar 15 12:25:47 PDT 2013
Author: mspencer
Date: Fri Mar 15 14:25:47 2013
New Revision: 177175
URL: http://llvm.org/viewvc/llvm-project?rev=177175&view=rev
Log:
[Support][Path][Windows] Fix dangling else. Don't call CloseHandle when CloseFD is false.
Modified:
llvm/trunk/lib/Support/Windows/PathV2.inc
Modified: llvm/trunk/lib/Support/Windows/PathV2.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Windows/PathV2.inc?rev=177175&r1=177174&r2=177175&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Windows/PathV2.inc (original)
+++ llvm/trunk/lib/Support/Windows/PathV2.inc Fri Mar 15 14:25:47 2013
@@ -715,10 +715,10 @@ error_code mapped_file_region::init(int
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
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
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
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
// 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();
}
More information about the llvm-commits
mailing list