From 7c5b0ff1721f46dcd92b3c76e0dd3d5a2c493a89 Mon Sep 17 00:00:00 2001 From: akl Date: Tue, 24 Dec 2013 12:45:58 +0000 Subject: [PATCH] Fix of 0022449 ([CEA 1033] SegFault when running $MED_ROOT_DIR/bin/salome/TestMEDCouplingCorbaServ): 1) check that TMP environment variable exists, before getting it's value; 2) add $USER value into filename to avoid R/W problems between users. --- .../MEDCouplingMeshFieldFactoryComponent.cxx | 16 +++++++++++++--- .../MEDCouplingCorbaSwigTest.py | 9 +++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx index b24be2164..8de2380c1 100644 --- a/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx +++ b/src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx @@ -772,9 +772,19 @@ namespace SALOME_TEST std::string MEDCouplingCorbaServBasicsTest::buildFileNameForIOR() { - std::string ret; - ret+=getenv("TMP"); - ret+="/entryPointMEDCouplingCorba.ior"; + std::string tmpdir; + if (getenv("TMP")) + tmpdir = getenv("TMP"); + if (tmpdir == "") + tmpdir = "/tmp"; + + std::string username; + if ( getenv("USERNAME") ) + username = std::string(getenv("USERNAME"))+"_"; + else if ( getenv("USER") ) + username = std::string(getenv("USER"))+"_"; + + std::string ret = tmpdir+"/"+username+"entryPointMEDCouplingCorba.ior"; return ret; } } diff --git a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py index a8dd95ab5..be0107605 100644 --- a/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py +++ b/src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py @@ -600,8 +600,13 @@ class MEDCouplingCorbaServBasicsTest: return ret; def buildFileNameForIOR(self): - ret=os.getenv("TMP"); - ret+="/entryPointMEDCouplingCorba.ior"; + tmpdir=os.getenv("TMP", "/tmp"); + username=""; + if os.getenv("USERNAME"): + username = os.getenv("USERNAME")+"_"; + elif os.getenv("USER"): + username = os.getenv("USER")+"_"; + ret=tmpdir+"/"+username+"entryPointMEDCouplingCorba.ior"; return ret; pass -- 2.30.2