]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
[PortManager] create lock file in temporary folder, with 0666 permissions
authorCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Oct 2014 08:21:34 +0000 (10:21 +0200)
committerCédric Aguerre <cedric.aguerre@edf.fr>
Tue, 21 Oct 2014 08:21:34 +0000 (10:21 +0200)
bin/PortManager.py

index 8e7a31d63056a41b705050451153fff008522239..0d01ce950faa2c8bd90e4a002631014bc835fe2b 100644 (file)
@@ -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):