Blame SOURCES/7.4.136

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.136
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.136 (after 7.4.096)
22c937
Problem:    MS-Windows: When saving a file with a UNC path the file becomes
22c937
	    read-only.
22c937
Solution:   Don't mix up Win32 attributes and Unix attributes. (Ken Takata)
22c937
Files:	    src/os_mswin.c, src/os_win32.c
22c937
22c937
22c937
*** ../vim-7.4.135/src/os_mswin.c	2013-09-29 19:05:17.000000000 +0200
22c937
--- src/os_mswin.c	2014-01-10 13:03:19.000000000 +0100
22c937
***************
22c937
*** 617,624 ****
22c937
--- 617,638 ----
22c937
      p = buf + strlen(buf);
22c937
      if (p > buf)
22c937
  	mb_ptr_back(buf, p);
22c937
+ 
22c937
+     /* Remove trailing '\\' except root path. */
22c937
      if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':')
22c937
  	*p = NUL;
22c937
+ 
22c937
+     if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/'))
22c937
+     {
22c937
+ 	/* UNC root path must be followed by '\\'. */
22c937
+ 	p = vim_strpbrk(buf + 2, "\\/");
22c937
+ 	if (p != NULL)
22c937
+ 	{
22c937
+ 	    p = vim_strpbrk(p + 1, "\\/");
22c937
+ 	    if (p == NULL)
22c937
+ 		STRCAT(buf, "\\");
22c937
+ 	}
22c937
+     }
22c937
  #ifdef FEAT_MBYTE
22c937
      if (enc_codepage >= 0 && (int)GetACP() != enc_codepage
22c937
  # ifdef __BORLANDC__
22c937
*** ../vim-7.4.135/src/os_win32.c	2014-01-05 13:29:16.000000000 +0100
22c937
--- src/os_win32.c	2014-01-10 12:59:32.000000000 +0100
22c937
***************
22c937
*** 2890,2898 ****
22c937
      struct stat st;
22c937
      int		n;
22c937
  
22c937
-     if (name[0] == '\\' && name[1] == '\\')
22c937
- 	/* UNC path */
22c937
- 	return (long)win32_getattrs(name);
22c937
      n = mch_stat(name, &st);
22c937
      return n == 0 ? (long)st.st_mode : -1L;
22c937
  }
22c937
--- 2890,2895 ----
22c937
*** ../vim-7.4.135/src/version.c	2014-01-06 15:51:46.000000000 +0100
22c937
--- src/version.c	2014-01-10 13:04:43.000000000 +0100
22c937
***************
22c937
*** 740,741 ****
22c937
--- 740,743 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     136,
22c937
  /**/
22c937
22c937
-- 
22c937
hundred-and-one symptoms of being an internet addict:
22c937
128. You can access the Net -- via your portable and cellular phone.
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///