Avoid non-async-signal-safe functionality between fork and exec
This is a partial revert of 17642437fe "reduce
ifdef forest". The original code used unsetenv only for certain platforms, and
putenv for others, but code a few lines further down uses unsetenv
unconditionally, so assume that it is safe to use on all relevant platforms
these days.
unsetenv isn't listed as async-signal-safe at <http://pubs.opengroup.org/
onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04_03> "Signal Actions"
(but is already used a few lines further down, also between fork and exec), but
at least we get rid of the memory management involved in the OUString instance.
Change-Id: Iac993db8819d40a0841c455ed04ff9ca2ee2e4eb
Reviewed-on: https://gerrit.libreoffice.org/77368
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@@ -177,8 +177,7 @@ static void ChildStatusProc(void *pData)
|
||||
if (! INIT_GROUPS(data.m_name, data.m_gid) || (setuid(data.m_uid) != 0))
|
||||
SAL_WARN("sal.osl", "Failed to change uid and guid: " << UnixErrnoString(errno));
|
||||
|
||||
const OUString envVar("HOME");
|
||||
osl_clearEnvironment(envVar.pData);
|
||||
unsetenv("HOME");
|
||||
}
|
||||
|
||||
if (data.m_pszDir)
|
||||
|
||||
Reference in New Issue
Block a user