]> granicus.if.org Git - vim/commitdiff
updated for version 7.4.136 v7.4.136
authorBram Moolenaar <Bram@vim.org>
Fri, 10 Jan 2014 12:05:20 +0000 (13:05 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 10 Jan 2014 12:05:20 +0000 (13:05 +0100)
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)

src/os_mswin.c
src/os_win32.c
src/version.c

index 95c3d17380333be571ca0b0c8a2d1949cf413911..4b2f3cf073edadf54db246fe1e90745f277c3415 100644 (file)
@@ -617,8 +617,22 @@ vim_stat(const char *name, struct stat *stp)
     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__
index 5f671a7e91f0675c8f395664ffac0361c60a8542..b006a0db21ae00dba87423e794d50cf037a42e85 100644 (file)
@@ -2890,9 +2890,6 @@ mch_getperm(char_u *name)
     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;
 }
index 3400e6b025be403c4df8ee013ace51fdd398d93d..8eb9e4085d3d5e24910e28c4da97f43a325e58b7 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    136,
 /**/
     135,
 /**/