summaryrefslogtreecommitdiff
path: root/src/undo.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2013-09-08 15:40:49 +0200
committerBram Moolenaar <Bram@vim.org>2013-09-08 15:40:49 +0200
commit3b262393419ddf73e0bce95e0d896c46a95236d9 (patch)
tree84bf8ad9c3e971d2ba11a7c5426a6624805d5e82 /src/undo.c
parent3b7ac49e2672263840b5854402e7d24a7f3a8a23 (diff)
downloadvim-git-3b262393419ddf73e0bce95e0d896c46a95236d9.tar.gz
updated for version 7.4.024v7.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.
Diffstat (limited to 'src/undo.c')
-rw-r--r--src/undo.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/undo.c b/src/undo.c
index 3acfad1ff..eb99294aa 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -1604,10 +1604,11 @@ u_read_undo(name, hash, orig_name)
#ifdef UNIX
/* For safety we only read an undo file if the owner is equal to the
- * owner of the text file. */
+ * owner of the text file or equal to the current user. */
if (mch_stat((char *)orig_name, &st_orig) >= 0
&& mch_stat((char *)file_name, &st_undo) >= 0
- && st_orig.st_uid != st_undo.st_uid)
+ && st_orig.st_uid != st_undo.st_uid
+ && st_undo.st_uid != getuid())
{
if (p_verbose > 0)
{