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