From c432b41bbdd31389c59626e2ad63d85ac3dc5ba6 Mon Sep 17 00:00:00 2001 From: Heiko Voigt Date: Tue, 12 May 2009 17:40:56 +0200 Subject: [PATCH] only override the variables HOMEPATH and HOMEDRIVE if they are not set It seems that in old windows systems these variables were quite unreliable. So they were overriden by using the information the function NetGetInfo returned for the current user. As this does not seem to be true anymore we do not override them if they exist in the default environment. Signed-off-by: Heiko Voigt --- ...de-the-variables-HOMEPATH-and-HOMEDRIVE-i.patch | 46 ++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/rt/patches/0007-only-override-the-variables-HOMEPATH-and-HOMEDRIVE-i.patch diff --git a/src/rt/patches/0007-only-override-the-variables-HOMEPATH-and-HOMEDRIVE-i.patch b/src/rt/patches/0007-only-override-the-variables-HOMEPATH-and-HOMEDRIVE-i.patch new file mode 100644 index 00000000..499fc1ad --- /dev/null +++ b/src/rt/patches/0007-only-override-the-variables-HOMEPATH-and-HOMEDRIVE-i.patch @@ -0,0 +1,46 @@ +From dafcd879e192bba15c9016e993231bbce48bda6a Mon Sep 17 00:00:00 2001 +From: Heiko Voigt +Date: Tue, 12 May 2009 16:23:51 +0200 +Subject: [PATCH] only override the variables HOMEPATH and HOMEDRIVE if they are not set + +It seems that in old windows systems these variables were quite unreliable. +So they were overriden by using the information the function NetUserGetInfo +returned for the current user. As this does not seem to be true anymore +we do not override them if they exist in the default environment. + +Signed-off-by: Heiko Voigt +--- + source/winsup/cygwin/uinfo.cc | 10 +++++++--- + 1 files changed, 7 insertions(+), 3 deletions(-) + +diff --git a/source/winsup/cygwin/uinfo.cc b/source/winsup/cygwin/uinfo.cc +index 7f9b8a1..01f22e9 100644 +--- a/source/winsup/cygwin/uinfo.cc ++++ b/source/winsup/cygwin/uinfo.cc +@@ -80,7 +80,9 @@ internal_getlogin (cygheap_user &user) + WCHAR wlogsrv[INTERNET_MAX_HOST_NAME_LENGTH + 3]; + + /* HOMEDRIVE and HOMEPATH are wrong most of the time, too, +- after changing user context! */ ++ after changing user context! ++ As this does not be true anymore we only "correct" them ++ in case they do not exist. */ + sys_mbstowcs (wuser, user.name (), UNLEN + 1); + wlogsrv[0] = '\0'; + if (user.logsrv ()) +@@ -88,8 +90,10 @@ internal_getlogin (cygheap_user &user) + strcat (strcpy (buf, "\\\\"), user.logsrv ()); + sys_mbstowcs (wlogsrv, buf, INTERNET_MAX_HOST_NAME_LENGTH + 3); + } +- if (!NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui) +- || (wlogsrv[0] && !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui))) ++ if (!(getenv ("HOMEPATH") && getenv ("HOMEDRIVE")) ++ && (!NetUserGetInfo (NULL, wuser, 3, (LPBYTE *)&ui) ++ || (wlogsrv[0] ++ && !NetUserGetInfo (wlogsrv, wuser, 3,(LPBYTE *)&ui)))) + { + sys_wcstombs (buf, ui->usri3_home_dir, MAX_PATH); + if (!buf[0]) +-- +1.6.3.GIT + -- 2.11.4.GIT