[newlib-cygwin] Ignore non-absolute $HOME when started from native process
Corinna Vinschen
corinna@sourceware.org
Thu Jul 23 15:43:00 GMT 2015
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=1e80973f288a6285f73b4565e7c4fcee12713b72
commit 1e80973f288a6285f73b4565e7c4fcee12713b72
Author: Corinna Vinschen <corinna@vinschen.de>
Date: Thu Jul 23 17:42:07 2015 +0200
Ignore non-absolute $HOME when started from native process
* uinfo.cc (cygheap_user::ontherange): Ignore $HOME if it's not
starting with a slash (aka, absolute POSIX Path).
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diff:
---
winsup/cygwin/ChangeLog | 5 +++++
winsup/cygwin/release/2.2.0 | 3 +++
winsup/cygwin/uinfo.cc | 11 +++++++++--
3 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 2d8475b..55ea458 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2015-07-23 Corinna Vinschen <corinna@vinschen.de>
+
+ * uinfo.cc (cygheap_user::ontherange): Ignore $HOME if it's not
+ starting with a slash (aka, absolute POSIX Path).
+
2015-07-21 Corinna Vinschen <corinna@vinschen.de>
* common.din (siglongjmp): Export.
diff --git a/winsup/cygwin/release/2.2.0 b/winsup/cygwin/release/2.2.0
index 2fab1f6..39df25c 100644
--- a/winsup/cygwin/release/2.2.0
+++ b/winsup/cygwin/release/2.2.0
@@ -11,6 +11,9 @@ What's new:
What changed:
-------------
+- When started from a non-Cygwin process, check if $HOME starts with a
+ slash (absolute POSIX path). Otherwise ignore it.
+
Bug Fixes
---------
diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc
index bc5f814..334c2e9 100644
--- a/winsup/cygwin/uinfo.cc
+++ b/winsup/cygwin/uinfo.cc
@@ -331,8 +331,15 @@ cygheap_user::ontherange (homebodies what, struct passwd *pw)
char *p;
if ((p = getenv ("HOME")))
- debug_printf ("HOME is already in the environment %s", p);
- else
+ {
+ debug_printf ("HOME is already in the environment %s", p);
+ if (p[0] != '/')
+ {
+ p = NULL;
+ debug_printf ("discard HOME, no absolute POSIX path");
+ }
+ }
+ if (!p)
{
if (pw && pw->pw_dir && *pw->pw_dir)
{
More information about the Cygwin-cvs
mailing list