Mercurial > vim
comparison src/undo.c @ 5343:00d61a47df66 v7.4.024
updated for version 7.4.024
Problem: When root edits a file the undo file is owned by root while the
edited file may be owned by another user, which is not allowed.
(cac2s)
Solution: Accept an undo file owned by the current user.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 08 Sep 2013 15:40:49 +0200 |
parents | 60301d4d1682 |
children | d0595545e98a |
comparison
equal
deleted
inserted
replaced
5342:029dfae8314a | 5343:00d61a47df66 |
---|---|
1602 if (file_name == NULL) | 1602 if (file_name == NULL) |
1603 return; | 1603 return; |
1604 | 1604 |
1605 #ifdef UNIX | 1605 #ifdef UNIX |
1606 /* For safety we only read an undo file if the owner is equal to the | 1606 /* For safety we only read an undo file if the owner is equal to the |
1607 * owner of the text file. */ | 1607 * owner of the text file or equal to the current user. */ |
1608 if (mch_stat((char *)orig_name, &st_orig) >= 0 | 1608 if (mch_stat((char *)orig_name, &st_orig) >= 0 |
1609 && mch_stat((char *)file_name, &st_undo) >= 0 | 1609 && mch_stat((char *)file_name, &st_undo) >= 0 |
1610 && st_orig.st_uid != st_undo.st_uid) | 1610 && st_orig.st_uid != st_undo.st_uid |
1611 && st_undo.st_uid != getuid()) | |
1611 { | 1612 { |
1612 if (p_verbose > 0) | 1613 if (p_verbose > 0) |
1613 { | 1614 { |
1614 verbose_enter(); | 1615 verbose_enter(); |
1615 smsg((char_u *)_("Not reading undo file, owner differs: %s"), | 1616 smsg((char_u *)_("Not reading undo file, owner differs: %s"), |