]> sourceware.org Git - newlib-cygwin.git/commitdiff
Avoid name change if script is called via symlink from execvp et al.
authorCorinna Vinschen <vinschen@redhat.com>
Tue, 17 Mar 2015 10:40:12 +0000 (11:40 +0100)
committerCorinna Vinschen <vinschen@redhat.com>
Tue, 17 Mar 2015 10:40:12 +0000 (11:40 +0100)
* 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>
winsup/cygwin/ChangeLog
winsup/cygwin/release/1.7.36
winsup/cygwin/spawn.cc

index 18dcc2530ed359e1535cb726634e2212b6282a59..97b8104b318e5b1fc75adfe1dc1df6075a17ea00 100644 (file)
@@ -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.
index 1f89a979153826fba581a3dc6084fceaf62859ac..28797779a65858c9847d1d8f2c149962922e27ca 100644 (file)
@@ -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
index 720a9439103e2b46f89d4365436cc50c7cf62662..1cc5cf3945767a58247c62cff189d87e7fe261d8 100644 (file)
@@ -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;
     }
This page took 0.0365 seconds and 5 git commands to generate.