From 2f6d3d52be3c97408682be3aaa6a4bbea11aef08 Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Tue, 21 Apr 2015 07:16:37 +0200 Subject: 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 Tested-by: Christian Lohmaier Reviewed-by: Christian Lohmaier --- unotools/source/ucbhelper/tempfile.cxx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'unotools') diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index 70b4259d4bc4..0dbd0d6a2a6e 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -37,6 +37,8 @@ #ifdef UNX #include +#include +#include #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; -- cgit v1.2.3