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