vcl/source/filter/ieps/ieps.cxx | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
New commits: commit 65da768b9f60e5a52a266049d16ef74521dbaa7e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Tue Jul 9 13:08:23 2024 +0100 Commit: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> CommitDate: Wed Jul 10 11:45:44 2024 +0200 use a throwaway TMPDIR for ghostscript-using helpers Change-Id: Iba5a475399589c9e2c4fd485d613f0dedfe0dc44 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/170244 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> diff --git a/vcl/source/filter/ieps/ieps.cxx b/vcl/source/filter/ieps/ieps.cxx index bb4ea06b2a7a..93ac0ca2ef8b 100644 --- a/vcl/source/filter/ieps/ieps.cxx +++ b/vcl/source/filter/ieps/ieps.cxx @@ -152,6 +152,14 @@ static oslProcessError runProcessWithPathSearch(const OUString &rProgName, rtl_uString* pArgs[], sal_uInt32 nArgs, oslProcess *pProcess, oslFileHandle *pIn, oslFileHandle *pOut, oslFileHandle *pErr) { + // run things that directly or indirectly might call gs in a tmpdir of their own + utl::TempFileNamed aTMPDirectory(nullptr, true); + aTMPDirectory.EnableKillingFile(true); + OUString sTmpDirEnv = u"TMPDIR="_ustr + aTMPDirectory.GetFileName(); + + rtl_uString* ustrEnvironment[1]; + ustrEnvironment[0] = sTmpDirEnv.pData; + oslProcessError result = osl_Process_E_None; oslSecurity pSecurity = osl_getCurrentSecurity(); #ifdef _WIN32 @@ -179,11 +187,11 @@ static oslProcessError runProcessWithPathSearch(const OUString &rProgName, else result = osl_executeProcess_WithRedirectedIO(url.pData, pArgs, nArgs, osl_Process_HIDDEN, - pSecurity, nullptr, nullptr, 0, pProcess, pIn, pOut, pErr); + pSecurity, nullptr, ustrEnvironment, 1, pProcess, pIn, pOut, pErr); #else result = osl_executeProcess_WithRedirectedIO(rProgName.pData, pArgs, nArgs, osl_Process_SEARCHPATH | osl_Process_HIDDEN, - pSecurity, nullptr, nullptr, 0, pProcess, pIn, pOut, pErr); + pSecurity, nullptr, ustrEnvironment, 1, pProcess, pIn, pOut, pErr); #endif osl_freeSecurityHandle( pSecurity ); return result;