diff src/os_unix.c @ 17484:f1fd0b0b335c v8.1.1740

patch 8.1.1740: exepath() doesn't work for "bin/cat" commit https://github.com/vim/vim/commit/d08b8c4c04db9433340df38d21f0e26878f28421 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jul 24 14:59:45 2019 +0200 patch 8.1.1740: exepath() doesn't work for "bin/cat" Problem: Exepath() doesn't work for "bin/cat". Solution: Check for any path separator. (Daniel Hahler, closes https://github.com/vim/vim/issues/4724, closes #4710)
author Bram Moolenaar <Bram@vim.org>
date Wed, 24 Jul 2019 15:00:06 +0200
parents 3147c7c2e86b
children 10696f279e20
line wrap: on
line diff
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3103,12 +3103,11 @@ mch_can_exe(char_u *name, char_u **path,
 
     /* When "use_path" is false and if it's an absolute or relative path don't
      * need to use $PATH. */
-    if (!use_path || mch_isFullName(name) || (name[0] == '.'
-		   && (name[1] == '/' || (name[1] == '.' && name[2] == '/'))))
+    if (!use_path || gettail(name) != name)
     {
 	/* There must be a path separator, files in the current directory
 	 * can't be executed. */
-	if (gettail(name) != name && executable_file(name))
+	if ((use_path || gettail(name) != name) && executable_file(name))
 	{
 	    if (path != NULL)
 	    {