4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

2004-05-09 Pierre Humblet <pierre.humblet@ieee.org>

* environ.cc (build_env): Only try to construct required-but-missing
        variables while issetuid.
This commit is contained in:
Pierre Humblet 2004-05-09 15:17:15 +00:00
parent b5793c5c8c
commit 94f29ccdf6
2 changed files with 17 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2004-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* environ.cc (build_env): Only try to construct required-but-missing
variables while issetuid.
2004-05-08 Pierre Humblet <pierre.humblet@ieee.org>
Christopher Faylor <cgf@timesys.com>

View File

@ -910,17 +910,18 @@ build_env (const char * const *envp, char *&envblock, int &envc,
assert ((srcp - envp) == n);
/* Fill in any required-but-missing environment variables. */
for (unsigned i = 0; i < SPENVS_SIZE; i++)
if (!saw_spenv[i])
{
*dstp = spenvs[i].retrieve (no_envblock);
if (*dstp && !no_envblock && *dstp != env_dontadd)
{
tl += strlen (*dstp) + 1;
dstp++;
}
}
if (cygheap->user.issetuid ())
for (unsigned i = 0; i < SPENVS_SIZE; i++)
if (!saw_spenv[i])
{
*dstp = spenvs[i].retrieve (no_envblock);
if (*dstp && !no_envblock && *dstp != env_dontadd)
{
tl += strlen (*dstp) + 1;
dstp++;
}
}
envc = dstp - newenv; /* Number of entries in newenv */
assert ((size_t) envc <= (n + SPENVS_SIZE));
*dstp = NULL; /* Terminate */