home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.0.235 < prev    next >
Encoding:
Internet Message Format  |  2002-02-17  |  3.2 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.0.235
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.0.235
  11. Problem:    When writing a file and renaming the original file to make the
  12.         backup, permissions could change when setting the owner.
  13. Solution:   Only set the owner when it's needed and set the permissions again
  14.         afterwards.
  15.         When 'backupcopy' is "auto" check that the owner and permissions
  16.         of a newly created file can be set properly.
  17. Files:        src/fileio.c
  18.  
  19.  
  20. *** ../vim60.234/src/fileio.c    Mon Feb 11 16:56:42 2002
  21. --- src/fileio.c    Mon Feb 18 13:43:38 2002
  22. ***************
  23. *** 2665,2673 ****
  24.           else
  25.           {
  26.               chown((char *)IObuff, st_old.st_uid, st_old.st_gid);
  27.               if (mch_stat((char *)IObuff, &st) < 0
  28.                   || st.st_uid != st_old.st_uid
  29. !                 || st.st_gid != st_old.st_gid)
  30.               backup_copy = TRUE;
  31.               mch_remove(IObuff);
  32.           }
  33. --- 2673,2683 ----
  34.           else
  35.           {
  36.               chown((char *)IObuff, st_old.st_uid, st_old.st_gid);
  37. +             (void)mch_setperm((char *)IObuff, perm);
  38.               if (mch_stat((char *)IObuff, &st) < 0
  39.                   || st.st_uid != st_old.st_uid
  40. !                 || st.st_gid != st_old.st_gid
  41. !                 || st.st_mode != perm)
  42.               backup_copy = TRUE;
  43.               mch_remove(IObuff);
  44.           }
  45. ***************
  46. *** 3474,3479 ****
  47. --- 3484,3491 ----
  48.       mch_set_filetype(wfname, buf->b_p_oft);
  49.   #endif
  50.   #ifdef HAVE_ACL
  51. +     /* Probably need to set the ACL before changing the user (can't set the
  52. +      * ACL on a file the user doesn't own). */
  53.       if (!backup_copy)
  54.       mch_set_acl(wfname, acl);
  55.   #endif
  56. ***************
  57. *** 3483,3489 ****
  58.        * file.  Get the new device and inode number. */
  59.       if (backup != NULL && !backup_copy)
  60.       {
  61. !     chown((char *)wfname, st_old.st_uid, st_old.st_gid);
  62.       buf_setino(buf);
  63.       }
  64.   #endif
  65. --- 3495,3512 ----
  66.        * file.  Get the new device and inode number. */
  67.       if (backup != NULL && !backup_copy)
  68.       {
  69. !     struct stat    st;
  70. !     /* don't change the owner when it's already OK, some systems remove
  71. !      * permission or ACL stuff */
  72. !     if (mch_stat((char *)wfname, &st) < 0
  73. !         || st.st_uid != st_old.st_uid
  74. !         || st.st_gid != st_old.st_gid)
  75. !     {
  76. !         chown((char *)wfname, st_old.st_uid, st_old.st_gid);
  77. !         if (perm >= 0)    /* set permission again, may have changed */
  78. !         (void)mch_setperm(wfname, perm);
  79. !     }
  80.       buf_setino(buf);
  81.       }
  82.   #endif
  83. *** ../vim60.234/src/version.c    Mon Feb 18 12:58:16 2002
  84. --- src/version.c    Mon Feb 18 13:49:48 2002
  85. ***************
  86. *** 608,609 ****
  87. --- 608,611 ----
  88.   {   /* Add new patch number below this line */
  89. + /**/
  90. +     235,
  91.   /**/
  92.  
  93. -- 
  94. ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot.
  95.         King of all Britons, defeator of the Saxons, sovereign of all England!
  96.    [Pause]
  97. SOLDIER: Get away!
  98.                  "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
  99.  
  100.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  101. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  102. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  103.  \\\  Help me helping AIDS orphans in Uganda - http://iccf-holland.org  ///
  104.