From: akl Date: Tue, 24 Dec 2013 12:45:58 +0000 (+0000) Subject: Fix of 0022449 ([CEA 1033] SegFault when running $MED_ROOT_DIR/bin/salome/TestMEDCoup... X-Git-Tag: V7_3_1b1^2~43 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7c5b0ff1721f46dcd92b3c76e0dd3d5a2c493a89;p=modules%2Fmed.git 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. --- 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