home *** CD-ROM | disk | FTP | other *** search
- To: vim-dev@vim.org
- Subject: Patch 6.0.235
- Fcc: outbox
- From: Bram Moolenaar <Bram@moolenaar.net>
- MIME-Version: 1.0
- Content-Type: text/plain; charset=ISO-8859-1
- Content-Transfer-Encoding: 8bit
- ------------
-
- Patch 6.0.235
- Problem: When writing a file and renaming the original file to make the
- backup, permissions could change when setting the owner.
- Solution: Only set the owner when it's needed and set the permissions again
- afterwards.
- When 'backupcopy' is "auto" check that the owner and permissions
- of a newly created file can be set properly.
- Files: src/fileio.c
-
-
- *** ../vim60.234/src/fileio.c Mon Feb 11 16:56:42 2002
- --- src/fileio.c Mon Feb 18 13:43:38 2002
- ***************
- *** 2665,2673 ****
- else
- {
- chown((char *)IObuff, st_old.st_uid, st_old.st_gid);
- if (mch_stat((char *)IObuff, &st) < 0
- || st.st_uid != st_old.st_uid
- ! || st.st_gid != st_old.st_gid)
- backup_copy = TRUE;
- mch_remove(IObuff);
- }
- --- 2673,2683 ----
- else
- {
- chown((char *)IObuff, st_old.st_uid, st_old.st_gid);
- + (void)mch_setperm((char *)IObuff, perm);
- if (mch_stat((char *)IObuff, &st) < 0
- || st.st_uid != st_old.st_uid
- ! || st.st_gid != st_old.st_gid
- ! || st.st_mode != perm)
- backup_copy = TRUE;
- mch_remove(IObuff);
- }
- ***************
- *** 3474,3479 ****
- --- 3484,3491 ----
- mch_set_filetype(wfname, buf->b_p_oft);
- #endif
- #ifdef HAVE_ACL
- + /* Probably need to set the ACL before changing the user (can't set the
- + * ACL on a file the user doesn't own). */
- if (!backup_copy)
- mch_set_acl(wfname, acl);
- #endif
- ***************
- *** 3483,3489 ****
- * file. Get the new device and inode number. */
- if (backup != NULL && !backup_copy)
- {
- ! chown((char *)wfname, st_old.st_uid, st_old.st_gid);
- buf_setino(buf);
- }
- #endif
- --- 3495,3512 ----
- * file. Get the new device and inode number. */
- if (backup != NULL && !backup_copy)
- {
- ! struct stat st;
- !
- ! /* don't change the owner when it's already OK, some systems remove
- ! * permission or ACL stuff */
- ! if (mch_stat((char *)wfname, &st) < 0
- ! || st.st_uid != st_old.st_uid
- ! || st.st_gid != st_old.st_gid)
- ! {
- ! chown((char *)wfname, st_old.st_uid, st_old.st_gid);
- ! if (perm >= 0) /* set permission again, may have changed */
- ! (void)mch_setperm(wfname, perm);
- ! }
- buf_setino(buf);
- }
- #endif
- *** ../vim60.234/src/version.c Mon Feb 18 12:58:16 2002
- --- src/version.c Mon Feb 18 13:49:48 2002
- ***************
- *** 608,609 ****
- --- 608,611 ----
- { /* Add new patch number below this line */
- + /**/
- + 235,
- /**/
-
- --
- ARTHUR: It is I, Arthur, son of Uther Pendragon, from the castle of Camelot.
- King of all Britons, defeator of the Saxons, sovereign of all England!
- [Pause]
- SOLDIER: Get away!
- "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
-
- /// Bram Moolenaar -- Bram@moolenaar.net -- 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 ///
-