diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-04-21 07:16:37 +0200 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2015-04-21 09:40:54 +0000 |
commit | 2f6d3d52be3c97408682be3aaa6a4bbea11aef08 (patch) | |
tree | 60073d20f2708a77a8161a8b02e56cc98a0bc90d /unotools/source | |
parent | 647cff03bc052cecb5da048d49cad6384c3322f4 (diff) |
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@libreoffice.org>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Diffstat (limited to 'unotools/source')
-rw-r--r-- | unotools/source/ucbhelper/tempfile.cxx | 8 |
1 files changed, 7 insertions, 1 deletions
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 <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; |