summaryrefslogtreecommitdiffstats
path: root/patches/source/vim/patches/7.4.136
blob: 20976809a6b50331a73dfff57ef2c48a42b14f95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
To: vim_dev@googlegroups.com
Subject: Patch 7.4.136
Fcc: outbox
From: Bram Moolenaar <Bram@moolenaar.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
------------

Patch 7.4.136 (after 7.4.096)
Problem:    MS-Windows: When saving a file with a UNC path the file becomes
	    read-only.
Solution:   Don't mix up Win32 attributes and Unix attributes. (Ken Takata)
Files:	    src/os_mswin.c, src/os_win32.c


*** ../vim-7.4.135/src/os_mswin.c	2013-09-29 19:05:17.000000000 +0200
--- src/os_mswin.c	2014-01-10 13:03:19.000000000 +0100
***************
*** 617,624 ****
--- 617,638 ----
      p = buf + strlen(buf);
      if (p > buf)
  	mb_ptr_back(buf, p);
+ 
+     /* Remove trailing '\\' except root path. */
      if (p > buf && (*p == '\\' || *p == '/') && p[-1] != ':')
  	*p = NUL;
+ 
+     if ((buf[0] == '\\' && buf[1] == '\\') || (buf[0] == '/' && buf[1] == '/'))
+     {
+ 	/* UNC root path must be followed by '\\'. */
+ 	p = vim_strpbrk(buf + 2, "\\/");
+ 	if (p != NULL)
+ 	{
+ 	    p = vim_strpbrk(p + 1, "\\/");
+ 	    if (p == NULL)
+ 		STRCAT(buf, "\\");
+ 	}
+     }
  #ifdef FEAT_MBYTE
      if (enc_codepage >= 0 && (int)GetACP() != enc_codepage
  # ifdef __BORLANDC__
*** ../vim-7.4.135/src/os_win32.c	2014-01-05 13:29:16.000000000 +0100
--- src/os_win32.c	2014-01-10 12:59:32.000000000 +0100
***************
*** 2890,2898 ****
      struct stat st;
      int		n;
  
-     if (name[0] == '\\' && name[1] == '\\')
- 	/* UNC path */
- 	return (long)win32_getattrs(name);
      n = mch_stat(name, &st);
      return n == 0 ? (long)st.st_mode : -1L;
  }
--- 2890,2895 ----
*** ../vim-7.4.135/src/version.c	2014-01-06 15:51:46.000000000 +0100
--- src/version.c	2014-01-10 13:04:43.000000000 +0100
***************
*** 740,741 ****
--- 740,743 ----
  {   /* Add new patch number below this line */
+ /**/
+     136,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
128. You can access the Net -- via your portable and cellular phone.

 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///