[Libreoffice-commits] core.git: unotools/source

Markus Mohrhard markus.mohrhard at googlemail.com
Tue Apr 21 02:44:02 PDT 2015


 unotools/source/ucbhelper/tempfile.cxx |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 2f6d3d52be3c97408682be3aaa6a4bbea11aef08
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Tue Apr 21 07:16:37 2015 +0200

    try to find a unique naming scheme for temp files
    
    This should hopefully avoid name clashes during the test runs. During
    the test runs two tests can try to access the same temp file which
    causes one test to fail. Using the pid as part of the temp file name
    should avoid that problem.
    
    Change-Id: I696c3d34e33a5d8e9234238d86f1201ecdfa66ec
    Reviewed-on: https://gerrit.libreoffice.org/15455
    Tested-by: Jenkins <ci at libreoffice.org>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
    Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx
index 70b4259..0dbd0d6 100644
--- a/unotools/source/ucbhelper/tempfile.cxx
+++ b/unotools/source/ucbhelper/tempfile.cxx
@@ -37,6 +37,8 @@
 
 #ifdef UNX
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
 #endif
 
 using namespace osl;
@@ -290,13 +292,17 @@ OUString lcl_createName(
 OUString CreateTempName_Impl( const OUString* pParent, bool bKeep, bool bDir = true )
 {
     OUString aEyeCatcher = "lu";
-#ifdef DBG_UTIL
 #ifdef UNX
+#ifdef DBG_UTIL
     const char* eye = getenv("LO_TESTNAME");
     if(eye)
     {
         aEyeCatcher = OUString(eye, strlen(eye), RTL_TEXTENCODING_ASCII_US);
     }
+#else
+    static const pid_t pid = getpid();
+    static const OUString aPidString = OUString::number(pid);
+    aEyeCatcher += aPidString;
 #endif
 #endif
     UniqueTokens t;


More information about the Libreoffice-commits mailing list