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