Salome HOME
Fix of 0022449 ([CEA 1033] SegFault when running $MED_ROOT_DIR/bin/salome/TestMEDCoup...
authorakl <akl@opencascade.com>
Tue, 24 Dec 2013 12:45:58 +0000 (12:45 +0000)
committerakl <akl@opencascade.com>
Tue, 24 Dec 2013 12:45:58 +0000 (12:45 +0000)
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.

src/MEDCouplingCorba/Test/MEDCouplingMeshFieldFactoryComponent.cxx
src/MEDCouplingCorba_Swig/MEDCouplingCorbaSwigTest.py

index b24be2164ca7c98e890fc814b25c0436d35d6522..8de2380c1e9f658e81c7a1288ff744a482a43e80 100644 (file)
@@ -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;
   }
 }
index a8dd95ab5a62aee8d75d7566bb269ab42e940396..be0107605606690ff195218e6925f8388a705c52 100644 (file)
@@ -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