From fd23426f32248e9715e02a133487bd3bff8f54ad Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=A9dric=20Aguerre?= Date: Tue, 21 Oct 2014 10:21:34 +0200 Subject: [PATCH] [PortManager] create lock file in temporary folder, with 0666 permissions --- bin/PortManager.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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): -- 2.39.2