diff options
author | Christopher Faylor <me@cgf.cx> | 2002-06-12 05:13:54 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-06-12 05:13:54 +0000 |
commit | da086d020cc3fd5c0a374ca753dfb0bc62a3cda0 (patch) | |
tree | 66bfacfed261a4c61efbf482a93606fac66b96f2 /winsup/cygwin/spawn.cc | |
parent | 09c95bb14fd314b0529e1183c26d72dba386832a (diff) | |
download | cygnal-da086d020cc3fd5c0a374ca753dfb0bc62a3cda0.tar.gz cygnal-da086d020cc3fd5c0a374ca753dfb0bc62a3cda0.tar.bz2 cygnal-da086d020cc3fd5c0a374ca753dfb0bc62a3cda0.zip |
* cygheap.cc (cygheap_user::set_name): Set homedrive and homepath to NULL on
user name change.
(cygheap_user::set_logsrv): Allocate enough space for leading \\ so that we can
put this in the environment, if needed.
* cygheap.h (homebodies): New enum.
(cygheap_user::homedrive): New field.
(cygheap_user::homepath): Ditto.
(cygheap_user::env_logsrv): New method.
(cygheap_user::env_homepath): New method.
(cygheap_user::env_homedrive): New method.
(cygheap_user::env_userprofile): New method.
(cygheap_user::ontherange): New method.
* environ.cc (envsize): Eliminate debugging argument.
(environ_init): Assume that envc counts number of elments not total size.
(spenv): New class.
(spenvs): New array, renamed from forced_winenv_vars, using spenv.
(spenv::retrieve): New method.
(build_env): Rename from 'winenv' -- one stop shopping for building new
environment blocks for both windows and "unix".
* environ.h (build_env: Declare.
(winenv): Delete declaration.
(envsize): Ditto.
* spawn.cc (spawn_guts): Use build_env to build windows and cygwin environment
blocks.
* uinfo.cc (internal_getlogin): Eliminate environment manipulation. Default to
info from GetUserName if it exists. Move HOMEPATH and HOMEDRIVE stuff
elsewhere. Move HOME setting elsewhere. Only set HOME environment variable in
processes that are not parented by a cygwin process.
(cygheap_user::ontherange): Define new method.
(cygheap_user::env_logsrv): Ditto.
(cygheap_user::env_homepath): Ditto.
(cygheap_user::env_homedrive): Ditto.
(cygheap_user::env_userprofile): Ditto.
Diffstat (limited to 'winsup/cygwin/spawn.cc')
-rw-r--r-- | winsup/cygwin/spawn.cc | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc index 12e82a64d..e5d9bfe86 100644 --- a/winsup/cygwin/spawn.cc +++ b/winsup/cygwin/spawn.cc @@ -562,18 +562,14 @@ spawn_guts (const char * prog_arg, const char *const *argv, MALLOC_CHECK; } + char *envblock; newargv.all_calloced (); ciresrv.moreinfo->argc = newargv.argc; ciresrv.moreinfo->argv = newargv; - - ciresrv.moreinfo->envc = envsize (envp, 1); - ciresrv.moreinfo->envp = (char **) cmalloc (HEAP_1_ARGV, ciresrv.moreinfo->envc); ciresrv.hexec_proc = hexec_proc; - char **c; - const char * const *e; - for (c = ciresrv.moreinfo->envp, e = envp; *e;) - *c++ = cstrdup1 (*e++); - *c = NULL; + ciresrv.moreinfo->envp = build_env (envp, envblock, ciresrv.moreinfo->envc, + real_path.iscygexec ()); + if (mode != _P_OVERLAY || !DuplicateHandle (hMainProc, myself.shared_handle (), hMainProc, &ciresrv.moreinfo->myself_pinfo, 0, @@ -605,13 +601,6 @@ spawn_guts (const char * prog_arg, const char *const *argv, flags |= CREATE_SUSPENDED; - /* Build windows style environment list */ - char *envblock; - if (real_path.iscygexec ()) - envblock = NULL; - else - envblock = winenv (envp, 0); - const char *runpath = null_app_name ? NULL : (const char *) real_path; syscall_printf ("null_app_name %d (%s, %.132s)", null_app_name, runpath, one_line.buf); |