summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-25 13:01:18 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-25 13:01:18 (GMT)
commit166e29e453e6a48e191b02835b08cf5bd3d0f988 (patch)
treeed5854583c17b708a72ae2b3272a2a9cfa7f07ac /Source
parent26c43005847394ab110ebbdb29f1a1f37eaa7b7a (diff)
parent1f289095f908fddd64152c5686bec25eecbc66d6 (diff)
downloadCMake-166e29e453e6a48e191b02835b08cf5bd3d0f988.zip
CMake-166e29e453e6a48e191b02835b08cf5bd3d0f988.tar.gz
CMake-166e29e453e6a48e191b02835b08cf5bd3d0f988.tar.bz2
Merge topic 'file-LOCK-close'
1f289095 file(LOCK): Close file descriptor/handle when releasing a lock
Diffstat (limited to 'Source')
-rw-r--r--Source/cmFileLockUnix.cxx4
-rw-r--r--Source/cmFileLockWin32.cxx3
2 files changed, 7 insertions, 0 deletions
diff --git a/Source/cmFileLockUnix.cxx b/Source/cmFileLockUnix.cxx
index fc18a64..36a2d72 100644
--- a/Source/cmFileLockUnix.cxx
+++ b/Source/cmFileLockUnix.cxx
@@ -15,6 +15,7 @@
#include <errno.h> // errno
#include <stdio.h> // SEEK_SET
#include <fcntl.h>
+#include <unistd.h>
#include "cmSystemTools.h"
cmFileLock::cmFileLock(): File(-1)
@@ -31,6 +32,9 @@ cmFileLockResult cmFileLock::Release()
this->Filename = "";
+ ::close(this->File);
+ this->File = -1;
+
if (lockResult == 0)
{
return cmFileLockResult::MakeOk();
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();