diff src/ex_cmds.c @ 6049:7b3248267575 v7.4.364

updated for version 7.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.
author Bram Moolenaar <bram@vim.org>
date Wed, 09 Jul 2014 21:18:04 +0200
parents 81f5a056b2a5
children 7766142fc7d3
line wrap: on
line diff
--- 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