Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <vinschen@redhat.com>2015-03-17 13:40:12 +0300
committerCorinna Vinschen <vinschen@redhat.com>2015-03-17 13:40:12 +0300
commit8f00fa7f36af6d35cd5f1f3c910b9215d7cb3e41 (patch)
tree4e8a0a192752f2895f453c97d392e3bb0ec0603f
parent44e5c14e089727b34a4ee8d48063259e4e23f674 (diff)
Avoid name change if script is called via symlink from execvp et al.
* spawn.cc (find_exec): Fix a name change in case of a symlink which can be opened as is. Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/release/1.7.363
-rw-r--r--winsup/cygwin/spawn.cc12
3 files changed, 14 insertions, 6 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index 18dcc2530..97b8104b3 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-17 Corinna Vinschen <corinna@vinschen.de>
+
+ * spawn.cc (find_exec): Fix a name change in case of a symlink which
+ can be opened as is.
+
2015-03-12 Jon TURNEY <jon.turney@dronecode.org.uk>
* exceptions.cc (stack_info): Add sigstackptr member.
diff --git a/winsup/cygwin/release/1.7.36 b/winsup/cygwin/release/1.7.36
index 1f89a9791..28797779a 100644
--- a/winsup/cygwin/release/1.7.36
+++ b/winsup/cygwin/release/1.7.36
@@ -15,3 +15,6 @@ Bug Fixes
- Fix potential premature SIGHUP in pty code.
Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00070.html
+
+- Fix a name change from symlink to target name in calls to execvp, system, etc.
+ Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00270.html
diff --git a/winsup/cygwin/spawn.cc b/winsup/cygwin/spawn.cc
index 720a94391..1cc5cf394 100644
--- a/winsup/cygwin/spawn.cc
+++ b/winsup/cygwin/spawn.cc
@@ -104,13 +104,13 @@ find_exec (const char *name, path_conv& buf, const char *search,
if ((has_slash || opt & FE_CWD)
&& (suffix = perhaps_suffix (name, buf, err, opt)) != NULL)
{
+ /* Overwrite potential symlink target with original path.
+ See comment preceeding this method. */
+ tmp_path = tmp;
if (!has_slash)
- {
- /* Overwrite potential symlink target with original path.
- See comment preceeding this method. */
- stpcpy (stpcpy (tmp, "./"), name);
- buf.set_posix (tmp);
- }
+ tmp_path = stpcpy (tmp, "./");
+ stpcpy (tmp_path, name);
+ buf.set_posix (tmp);
retval = buf.get_posix ();
goto out;
}