From da086d020cc3fd5c0a374ca753dfb0bc62a3cda0 Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Wed, 12 Jun 2002 05:13:54 +0000 Subject: * 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. --- winsup/cygwin/cygheap.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'winsup/cygwin/cygheap.cc') diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc index d6ce676..bd6ae3c 100644 --- a/winsup/cygwin/cygheap.cc +++ b/winsup/cygwin/cygheap.cc @@ -443,6 +443,8 @@ cygheap_user::set_name (const char *new_name) if (pname) cfree (pname); pname = cstrdup (new_name ? new_name : ""); + homedrive = NULL; + homepath = NULL; } void @@ -450,7 +452,13 @@ cygheap_user::set_logsrv (const char *new_logsrv) { if (plogsrv) cfree (plogsrv); - plogsrv = (new_logsrv && *new_logsrv) ? cstrdup (new_logsrv) : NULL; + if (!new_logsrv || !*new_logsrv) + plogsrv = NULL; + else + { + plogsrv = (char *) cmalloc (HEAP_STR, strlen (new_logsrv) + 3) + 2; + strcpy (plogsrv, new_logsrv); + } } void -- cgit v1.1