summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-07-09 21:18:04 +0200
committerBram Moolenaar <Bram@vim.org>2014-07-09 21:18:04 +0200
commit3ed8b1332f7b84e40c89069e54d411d0ddfec3f1 (patch)
treee29a203802e5d35e4c1671ec8cc7eaa76e8e8076 /src/ex_cmds.c
parent455009122a23050ef31c428df4155ad418b2e6fc (diff)
updated for version 7.4.364v7.4.364
Problem: When the viminfo file can't be renamed there is no error message. (Vladimir Berezhnoy) Solution: Check for the rename to fail.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 2e5917f4a2..62621bfa57 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -2004,11 +2004,14 @@ write_viminfo(file, forceit)
{
fclose(fp_in);
- /*
- * In case of an error keep the original viminfo file.
- * Otherwise rename the newly written file.
- */
- if (viminfo_errcnt || vim_rename(tempname, fname) == -1)
+ /* In case of an error keep the original viminfo file. Otherwise
+ * rename the newly written file. Give an error if that fails. */
+ if (viminfo_errcnt == 0 && vim_rename(tempname, fname) == -1)
+ {
+ ++viminfo_errcnt;
+ EMSG2(_("E886: Can't rename viminfo file to %s!"), fname);
+ }
+ if (viminfo_errcnt > 0)
mch_remove(tempname);
#ifdef WIN3264