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