summaryrefslogtreecommitdiffstats
path: root/winsup/cygwin/environ.cc
diff options
context:
space:
mode:
authorPierre Humblet <phumblet@phumblet.no-ip.org>2004-05-09 15:17:15 +0000
committerPierre Humblet <phumblet@phumblet.no-ip.org>2004-05-09 15:17:15 +0000
commit94f29ccdf6f99197d2de941e5411a9d5b6c787d6 (patch)
treeddb6413cf2083782a57d16cd3ed76cefc56ce173 /winsup/cygwin/environ.cc
parentb5793c5c8ca501977bf5374c159223c8ac20207d (diff)
downloadcygnal-94f29ccdf6f99197d2de941e5411a9d5b6c787d6.tar.gz
cygnal-94f29ccdf6f99197d2de941e5411a9d5b6c787d6.tar.bz2
cygnal-94f29ccdf6f99197d2de941e5411a9d5b6c787d6.zip
2004-05-09 Pierre Humblet <pierre.humblet@ieee.org>
* environ.cc (build_env): Only try to construct required-but-missing variables while issetuid.
Diffstat (limited to 'winsup/cygwin/environ.cc')
-rw-r--r--winsup/cygwin/environ.cc23
1 files changed, 12 insertions, 11 deletions
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 749d8139f..be4b88408 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -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 */