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>
This commit is contained in:
		| @@ -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> | 2015-03-12  Jon TURNEY  <jon.turney@dronecode.org.uk> | ||||||
|  |  | ||||||
| 	* exceptions.cc (stack_info): Add sigstackptr member. | 	* exceptions.cc (stack_info): Add sigstackptr member. | ||||||
|   | |||||||
| @@ -15,3 +15,6 @@ Bug Fixes | |||||||
|  |  | ||||||
| - Fix potential premature SIGHUP in pty code. | - Fix potential premature SIGHUP in pty code. | ||||||
|   Addresses: https://cygwin.com/ml/cygwin/2015-03/msg00070.html |   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 | ||||||
|   | |||||||
| @@ -104,13 +104,13 @@ find_exec (const char *name, path_conv& buf, const char *search, | |||||||
|   if ((has_slash || opt & FE_CWD) |   if ((has_slash || opt & FE_CWD) | ||||||
|       && (suffix = perhaps_suffix (name, buf, err, opt)) != NULL) |       && (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) |       if (!has_slash) | ||||||
| 	{ | 	tmp_path = stpcpy (tmp, "./"); | ||||||
| 	  /* Overwrite potential symlink target with original path. |       stpcpy (tmp_path, name); | ||||||
| 	     See comment preceeding this method. */ |       buf.set_posix (tmp); | ||||||
| 	  stpcpy (stpcpy (tmp, "./"), name); |  | ||||||
| 	  buf.set_posix (tmp); |  | ||||||
| 	} |  | ||||||
|       retval = buf.get_posix (); |       retval = buf.get_posix (); | ||||||
|       goto out; |       goto out; | ||||||
|     } |     } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user