aboutsummaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2009-05-06 11:52:20 +0000
committerCorinna Vinschen <corinna@vinschen.de>2009-05-06 11:52:20 +0000
commit764d88e4a75f244b9c92af0ea27cb4bb86f14d4d (patch)
tree62f93af56a40b25738d49435934a40fb4724e0ef /winsup
parent3227665e1995fe103b31d17fd4a2cddcd6cdde97 (diff)
downloadnewlib-764d88e4a75f244b9c92af0ea27cb4bb86f14d4d.zip
newlib-764d88e4a75f244b9c92af0ea27cb4bb86f14d4d.tar.gz
newlib-764d88e4a75f244b9c92af0ea27cb4bb86f14d4d.tar.bz2
* cygheap.cc (cygheap_init): Set umask to a sane default.
* uinfo.cc (cygheap_user::ontherange): Don't use HOMEDRIVE/HOMEPATH to set HOME. Default to /home/USERNAME.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog6
-rw-r--r--winsup/cygwin/cygheap.cc2
-rw-r--r--winsup/cygwin/uinfo.cc22
3 files changed, 12 insertions, 18 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 4ca22d8..3374f58 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-06 Corinna Vinschen <corinna@vinschen.de>
+
+ * cygheap.cc (cygheap_init): Set umask to a sane default.
+ * uinfo.cc (cygheap_user::ontherange): Don't use HOMEDRIVE/HOMEPATH
+ to set HOME. Default to /home/USERNAME.
+
2009-05-03 Corinna Vinschen <corinna@vinschen.de>
* security.cc (set_file_sd): Drop using FILE_OPEN_FOR_RECOVERY flag in
diff --git a/winsup/cygwin/cygheap.cc b/winsup/cygwin/cygheap.cc
index bddc6ce..1e579f3 100644
--- a/winsup/cygwin/cygheap.cc
+++ b/winsup/cygwin/cygheap.cc
@@ -156,6 +156,8 @@ cygheap_init ()
_cygheap_mid - _cygheap_start);
cygheap_max = cygheap;
_csbrk (sizeof (*cygheap));
+ /* Set umask to a sane default. */
+ cygheap->umask = 022;
}
if (!cygheap->fdtab)
cygheap->fdtab.init ();
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index 8ca382b..8adfd37 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -248,15 +248,6 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
if (what == CH_HOME)
{
char *p;
- if (homedrive)
- newhomedrive = homedrive;
- else if ((p = getenv ("HOMEDRIVE")))
- newhomedrive = p;
-
- if (homepath)
- newhomepath = homepath;
- else if ((p = getenv ("HOMEPATH")))
- newhomepath = p;
if ((p = getenv ("HOME")))
debug_printf ("HOME is already in the environment %s", p);
@@ -267,17 +258,12 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
debug_printf ("Set HOME (from /etc/passwd) to %s", pw->pw_dir);
setenv ("HOME", pw->pw_dir, 1);
}
- else if (!newhomedrive || !newhomepath)
- setenv ("HOME", "/", 1);
else
{
- char *home = tp.c_get ();
- char *buf = tp.c_get ();
- strcpy (buf, newhomedrive);
- strcat (buf, newhomepath);
- cygwin_conv_path (CCP_WIN_A_TO_POSIX | CCP_ABSOLUTE, buf, home,
- NT_MAX_PATH);
- debug_printf ("Set HOME (from HOMEDRIVE/HOMEPATH) to %s", home);
+ char home[strlen (name ()) + 8];
+
+ debug_printf ("Set HOME to default /home/USER");
+ __small_sprintf (home, "/home/%s", name ());
setenv ("HOME", home, 1);
}
}