Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-06-15 01:46:19 +0400
committerChristopher Faylor <me@cgf.cx>2002-06-15 01:46:19 +0400
commit6d171b4482689bd1c8a49af94e57d451c8f66448 (patch)
treebabdadeed9f28974354c25073eb06863c7f9da03 /winsup
parentb56d7e7937d0604025833e8c881f96c1d0e4147f (diff)
* cygheap.h (cygheap_user::userprofile_env_buf): New static member.
* environ.cc (build_env): Add debugging statement. (spenvs): Switch functions for USERDOMAIN and USERNAME. * spawn.cc (spawn_guts): Move environment initialization prior to cygheap_setup_for_child or environment info will never be copied to child.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog9
-rw-r--r--winsup/cygwin/cygheap.h3
-rw-r--r--winsup/cygwin/environ.cc5
-rw-r--r--winsup/cygwin/spawn.cc4
-rw-r--r--winsup/cygwin/uinfo.cc6
5 files changed, 20 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 1b0e04c42..933c9007a 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,14 @@
2002-06-14 Christopher Faylor <cgf@redhat.com>
+ * cygheap.h (cygheap_user::userprofile_env_buf): New static member.
+ * environ.cc (build_env): Add debugging statement.
+ (spenvs): Switch functions for USERDOMAIN and USERNAME.
+ * spawn.cc (spawn_guts): Move environment initialization prior to
+ cygheap_setup_for_child or environment info will never be copied to
+ child.
+
+2002-06-14 Christopher Faylor <cgf@redhat.com>
+
* cygheap.h (cygheap_user): Add static members to hold home{drive,path}
info.
* uinfo.cc (cygheap_user::ontherange): Use static class members for
diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index d50e16eea..f8777ccd9 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -109,6 +109,9 @@ class cygheap_user
info may live. */
static char homepath_env_buf[MAX_PATH + 1]; /* Where the HOMEPATH environment
variable info may live. */
+ static char userprofile_env_buf[MAX_PATH + 1]; /* Where the USERPROFILE
+ environment variable info
+ may live. */
public:
__uid32_t orig_uid; /* Remains intact even after impersonation */
__gid32_t orig_gid; /* Ditto */
diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc
index 737c68d7f..9ed6e4142 100644
--- a/winsup/cygwin/environ.cc
+++ b/winsup/cygwin/environ.cc
@@ -765,8 +765,8 @@ static NO_COPY spenv spenvs[] =
{"LOGONSERVER=", &cygheap_user::env_logsrv},
{"SYSTEMDRIVE=", NULL},
{"SYSTEMROOT=", NULL},
- {"USERDOMAIN=", &cygheap_user::env_name},
- {"USERNAME=", &cygheap_user::env_domain},
+ {"USERDOMAIN=", &cygheap_user::env_domain},
+ {"USERNAME=", &cygheap_user::env_name},
{"USERPROFILE=", &cygheap_user::env_userprofile},
};
@@ -939,6 +939,7 @@ build_env (const char * const *envp, char *&envblock, int &envc,
of buffer */
}
+ debug_printf ("envp %p, envc %d", newenv, envc);
return newenv;
}
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 1f92c7f76..3841e845b 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -613,9 +613,9 @@ spawn_guts (const char * prog_arg, const char *const *argv,
if (!cygheap->user.impersonated || cygheap->user.token == INVALID_HANDLE_VALUE)
{
PSECURITY_ATTRIBUTES sec_attribs = sec_user_nih (sa_buf);
- newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
ciresrv.moreinfo->envp = build_env (envp, envblock, ciresrv.moreinfo->envc,
real_path.iscygexec ());
+ newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
rc = CreateProcess (runpath, /* image name - with full path */
one_line.buf, /* what was passed to exec */
sec_attribs, /* process security attrs */
@@ -656,9 +656,9 @@ spawn_guts (const char * prog_arg, const char *const *argv,
strcat (wstname, dskname);
si.lpDesktop = wstname;
- newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
ciresrv.moreinfo->envp = build_env (envp, envblock, ciresrv.moreinfo->envc,
real_path.iscygexec ());
+ newheap = cygheap_setup_for_child (&ciresrv, cygheap->fdtab.need_fixup_before ());
rc = CreateProcessAsUser (cygheap->user.token,
runpath, /* image name - with full path */
one_line.buf, /* what was passed to exec */
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index bd7b3cb8b..e20c4b704 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -190,6 +190,7 @@ cuserid (char *src)
char cygheap_user::homepath_env_buf[MAX_PATH + 1];
char cygheap_user::homedrive_env_buf[3];
+char cygheap_user::userprofile_env_buf[MAX_PATH + 1];
const char *
cygheap_user::ontherange (homebodies what, struct passwd *pw)
@@ -335,12 +336,11 @@ cygheap_user::env_domain ()
const char *
cygheap_user::env_userprofile ()
{
- static char buf[512]; /* FIXME: This shouldn't be static. */
if (strcasematch (name (), "SYSTEM") || !env_domain () || !env_logsrv ())
return NULL;
- if (get_registry_hive_path (sid (), buf))
- return buf;
+ if (get_registry_hive_path (sid (), userprofile_env_buf))
+ return userprofile_env_buf;
else
return NULL;
}