Mercurial > vim
changeset 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 | 17e9c2874a58 |
children | f5c7483cbbb4 |
files | src/ex_cmds.c src/version.c |
diffstat | 2 files changed, 10 insertions(+), 5 deletions(-) [+] |
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