To: [email protected]
Subject: Patch 6.1b.029
Fcc: outbox
From: Bram Moolenaar <[email protected]>
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
------------

Patch 6.1b.029
Problem:    Win32: When a directory on an NTFS partition is read/execute (no
           delete,modify,write) and the file has modify rights, trying to
           write the file deletes it.  Making the file read/write/execute
           (not delete) solves it. (Mark Canup)
Solution:   Use the Unix code to check for a writable directory.  If not, then
           make a backup copy and overwrite the file.
Files:      src/fileio.c


*** ../vim61b.028/src/fileio.c  Sun Mar 17 14:22:46 2002
--- src/fileio.c        Tue Mar 19 22:34:17 2002
***************
*** 2633,2644 ****
     {
       if (*p_bkc == 'y' || append)    /* "yes" */
           backup_copy = TRUE;
! #ifdef UNIX
       else if (*p_bkc == 'a')         /* "auto" */
       {
           struct stat st;
           int         i;

           /*
            * Don't rename the file when:
            * - it's a hard link
--- 2633,2645 ----
     {
       if (*p_bkc == 'y' || append)    /* "yes" */
           backup_copy = TRUE;
! #if defined(UNIX) || defined(WIN32)
       else if (*p_bkc == 'a')         /* "auto" */
       {
           struct stat st;
           int         i;

+ # ifdef UNIX
           /*
            * Don't rename the file when:
            * - it's a hard link
***************
*** 2652,2657 ****
--- 2653,2659 ----
                   || st.st_ino != st_old.st_ino)
               backup_copy = TRUE;
           else
+ # endif
           {
               /*
                * Check if we can create a file and set the owner/group to
***************
*** 2672,2677 ****
--- 2674,2680 ----
                   backup_copy = TRUE;
               else
               {
+ # ifdef UNIX
                   chown((char *)IObuff, st_old.st_uid, st_old.st_gid);
                   (void)mch_setperm(IObuff, perm);
                   if (mch_stat((char *)IObuff, &st) < 0
***************
*** 2679,2684 ****
--- 2682,2688 ----
                           || st.st_gid != st_old.st_gid
                           || st.st_mode != perm)
                       backup_copy = TRUE;
+ # endif
                   mch_remove(IObuff);
               }
           }
*** ../vim61b.028/src/version.c Tue Mar 19 20:16:24 2002
--- src/version.c       Tue Mar 19 22:40:44 2002
***************
*** 608,609 ****
--- 608,611 ----
 {   /* Add new patch number below this line */
+ /**/
+     29,
 /**/

--
Violators can be fined, arrested or jailed for making ugly faces at a dog.
               [real standing law in Oklahoma, United States of America]

///  Bram Moolenaar -- [email protected] -- http://www.moolenaar.net  \\\
///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
\\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
\\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///