Karsten Hopp 86a034
To: vim_dev@googlegroups.com
Karsten Hopp 86a034
Subject: Patch 7.4.428
Karsten Hopp 86a034
Fcc: outbox
Karsten Hopp 86a034
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 86a034
Mime-Version: 1.0
Karsten Hopp 86a034
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 86a034
Content-Transfer-Encoding: 8bit
Karsten Hopp 86a034
------------
Karsten Hopp 86a034
Karsten Hopp 86a034
Patch 7.4.428
Karsten Hopp 86a034
Problem:    executable() may return a wrong result on MS-Windows.
Karsten Hopp 86a034
Solution:   Change the way SearchPath() is called. (Yasuhiro Matsumoto, Ken
Karsten Hopp 86a034
	    Takata)
Karsten Hopp 86a034
Files:	    src/os_win32.c
Karsten Hopp 86a034
Karsten Hopp 86a034
Karsten Hopp 86a034
*** ../vim-7.4.427/src/os_win32.c	2014-07-09 20:51:04.515583033 +0200
Karsten Hopp 86a034
--- src/os_win32.c	2014-08-29 17:44:01.782467612 +0200
Karsten Hopp 86a034
***************
Karsten Hopp 86a034
*** 1906,1911 ****
Karsten Hopp 86a034
--- 1906,1913 ----
Karsten Hopp 86a034
  {
Karsten Hopp 86a034
      char	*dum;
Karsten Hopp 86a034
      char	fname[_MAX_PATH];
Karsten Hopp 86a034
+     char	*curpath, *newpath;
Karsten Hopp 86a034
+     long	n;
Karsten Hopp 86a034
  
Karsten Hopp 86a034
  #ifdef FEAT_MBYTE
Karsten Hopp 86a034
      if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
Karsten Hopp 86a034
***************
Karsten Hopp 86a034
*** 1913,1923 ****
Karsten Hopp 86a034
  	WCHAR	*p = enc_to_utf16(name, NULL);
Karsten Hopp 86a034
  	WCHAR	fnamew[_MAX_PATH];
Karsten Hopp 86a034
  	WCHAR	*dumw;
Karsten Hopp 86a034
! 	long	n;
Karsten Hopp 86a034
  
Karsten Hopp 86a034
  	if (p != NULL)
Karsten Hopp 86a034
  	{
Karsten Hopp 86a034
! 	    n = (long)SearchPathW(NULL, p, NULL, _MAX_PATH, fnamew, &dumw);
Karsten Hopp 86a034
  	    vim_free(p);
Karsten Hopp 86a034
  	    if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 86a034
  	    {
Karsten Hopp 86a034
--- 1915,1933 ----
Karsten Hopp 86a034
  	WCHAR	*p = enc_to_utf16(name, NULL);
Karsten Hopp 86a034
  	WCHAR	fnamew[_MAX_PATH];
Karsten Hopp 86a034
  	WCHAR	*dumw;
Karsten Hopp 86a034
! 	WCHAR	*wcurpath, *wnewpath;
Karsten Hopp 86a034
  
Karsten Hopp 86a034
  	if (p != NULL)
Karsten Hopp 86a034
  	{
Karsten Hopp 86a034
! 	    wcurpath = _wgetenv(L"PATH");
Karsten Hopp 86a034
! 	    wnewpath = (WCHAR*)alloc((unsigned)(wcslen(wcurpath) + 3)
Karsten Hopp 86a034
! 							    * sizeof(WCHAR));
Karsten Hopp 86a034
! 	    if (wnewpath == NULL)
Karsten Hopp 86a034
! 		return FALSE;
Karsten Hopp 86a034
! 	    wcscpy(wnewpath, L".;");
Karsten Hopp 86a034
! 	    wcscat(wnewpath, wcurpath);
Karsten Hopp 86a034
! 	    n = (long)SearchPathW(wnewpath, p, NULL, _MAX_PATH, fnamew, &dumw);
Karsten Hopp 86a034
! 	    vim_free(wnewpath);
Karsten Hopp 86a034
  	    vim_free(p);
Karsten Hopp 86a034
  	    if (n > 0 || GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
Karsten Hopp 86a034
  	    {
Karsten Hopp 86a034
***************
Karsten Hopp 86a034
*** 1933,1939 ****
Karsten Hopp 86a034
  	}
Karsten Hopp 86a034
      }
Karsten Hopp 86a034
  #endif
Karsten Hopp 86a034
!     if (SearchPath(NULL, name, NULL, _MAX_PATH, fname, &dum) == 0)
Karsten Hopp 86a034
  	return FALSE;
Karsten Hopp 86a034
      if (mch_isdir(fname))
Karsten Hopp 86a034
  	return FALSE;
Karsten Hopp 86a034
--- 1943,1958 ----
Karsten Hopp 86a034
  	}
Karsten Hopp 86a034
      }
Karsten Hopp 86a034
  #endif
Karsten Hopp 86a034
! 
Karsten Hopp 86a034
!     curpath = getenv("PATH");
Karsten Hopp 86a034
!     newpath = (char*)alloc((unsigned)(STRLEN(curpath) + 3));
Karsten Hopp 86a034
!     if (newpath == NULL)
Karsten Hopp 86a034
! 	return FALSE;
Karsten Hopp 86a034
!     STRCPY(newpath, ".;");
Karsten Hopp 86a034
!     STRCAT(newpath, curpath);
Karsten Hopp 86a034
!     n = (long)SearchPath(newpath, name, NULL, _MAX_PATH, fname, &dum;;
Karsten Hopp 86a034
!     vim_free(newpath);
Karsten Hopp 86a034
!     if (n == 0)
Karsten Hopp 86a034
  	return FALSE;
Karsten Hopp 86a034
      if (mch_isdir(fname))
Karsten Hopp 86a034
  	return FALSE;
Karsten Hopp 86a034
*** ../vim-7.4.427/src/version.c	2014-08-29 15:53:43.714453155 +0200
Karsten Hopp 86a034
--- src/version.c	2014-08-29 17:44:50.598467718 +0200
Karsten Hopp 86a034
***************
Karsten Hopp 86a034
*** 743,744 ****
Karsten Hopp 86a034
--- 743,746 ----
Karsten Hopp 86a034
  {   /* Add new patch number below this line */
Karsten Hopp 86a034
+ /**/
Karsten Hopp 86a034
+     428,
Karsten Hopp 86a034
  /**/
Karsten Hopp 86a034
Karsten Hopp 86a034
-- 
Karsten Hopp 86a034
You are only young once, but you can stay immature indefinitely.
Karsten Hopp 86a034
Karsten Hopp 86a034
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 86a034
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 86a034
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 86a034
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///