From: Cédric Aguerre Date: Tue, 21 Oct 2014 08:21:34 +0000 (+0200) Subject: [PortManager] create lock file in temporary folder, with 0666 permissions X-Git-Tag: V7_5_0b1~5 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fd23426f32248e9715e02a133487bd3bff8f54ad;p=modules%2Fkernel.git [PortManager] create lock file in temporary folder, with 0666 permissions --- diff --git a/bin/PortManager.py b/bin/PortManager.py index 8e7a31d63..0d01ce950 100644 --- a/bin/PortManager.py +++ b/bin/PortManager.py @@ -71,7 +71,11 @@ def _getConfigurationFilename(): suffix="PortManager", extension="cfg", hidden=True) - lock_file = portmanager_config + "-lock" + import tempfile + temp = tempfile.NamedTemporaryFile() + lock_file = os.path.join(os.path.dirname(temp.name), ".omniORB_PortManager.lock") + temp.close() + return (portmanager_config, lock_file) # @@ -103,6 +107,7 @@ def getPort(preferedPort=None): logger.debug("GET PORT") config_file, lock_file = _getConfigurationFilename() + oldmask = os.umask(0) with open(lock_file, 'w') as lock: # acquire lock __acquire_lock(lock) @@ -143,9 +148,11 @@ def getPort(preferedPort=None): # release lock __release_lock(lock) + # - logger.debug("get port: %s"%str(port)) - return port + os.umask(oldmask) + logger.debug("get port: %s"%str(port)) + return port # def releasePort(port):