[Cmake-commits] CMake branch, next, updated. v3.2.1-1211-g7ae7789

Brad King brad.king at kitware.com
Tue Mar 24 14:52:03 EDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d (commit)
       via  437be8dbb6eede6df0693c6b00370368bc832018 (commit)
      from  0cf09443232868edeb25143987f17c39745e71da (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d
commit 7ae7789e06051a8b8db16c5e3d2e7ef43ce44c6d
Merge: 0cf0944 437be8d
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Tue Mar 24 14:52:02 2015 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 24 14:52:02 2015 -0400

    Merge topic 'file-LOCK-close' into next
    
    437be8db file(LOCK): Close file descriptor/handle when releasing a lock


http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=437be8dbb6eede6df0693c6b00370368bc832018
commit 437be8dbb6eede6df0693c6b00370368bc832018
Author:     Betsy McPhail <betsy.mcphail at kitware.com>
AuthorDate: Mon Mar 23 16:32:12 2015 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Tue Mar 24 14:49:49 2015 -0400

    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 at yahoo.com>

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();

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list