summaryrefslogtreecommitdiffstats
path: root/Source/cmFileLockWin32.cxx
diff options
context:
space:
mode:
authorBetsy McPhail <betsy.mcphail@kitware.com>2015-03-23 20:32:12 (GMT)
committerBrad King <brad.king@kitware.com>2015-03-25 13:00:51 (GMT)
commit1f289095f908fddd64152c5686bec25eecbc66d6 (patch)
tree0a5011fec3d2e25e49d693771cac583880e710ea /Source/cmFileLockWin32.cxx
parent732d8a467ab8a295b1bbf580f865980f8a1a9b29 (diff)
downloadCMake-1f289095f908fddd64152c5686bec25eecbc66d6.zip
CMake-1f289095f908fddd64152c5686bec25eecbc66d6.tar.gz
CMake-1f289095f908fddd64152c5686bec25eecbc66d6.tar.bz2
file(LOCK): Close file descriptor/handle when releasing a lock
The file lock functionality added in commit v3.2.0-rc1~297^2~1 (file: Add LOCK subcommand to do file and directory locking, 2014-11-26) forgot to close the lock file descriptors. Eventually it was possible to run out of file descriptors and locks could not longer be acquired. Fix this by closing the file descriptor or handle when we are done with it. Also set the member back to the initial value from the constructor to leave everything in a consistent state (useful for debugging). Co-Author: Ruslan Baratov <ruslan_baratov@yahoo.com>
Diffstat (limited to 'Source/cmFileLockWin32.cxx')
-rw-r--r--Source/cmFileLockWin32.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/cmFileLockWin32.cxx b/Source/cmFileLockWin32.cxx
index 4691689..dc65948 100644
--- a/Source/cmFileLockWin32.cxx
+++ b/Source/cmFileLockWin32.cxx
@@ -38,6 +38,9 @@ cmFileLockResult cmFileLock::Release()
this->Filename = "";
+ CloseHandle(this->File);
+ this->File = INVALID_HANDLE_VALUE;
+
if (unlockResult)
{
return cmFileLockResult::MakeOk();