diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-18 14:05:58 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-05-18 14:12:08 -0400 |
commit | d07a6e2b45175439891beafc5e75f68f92eabd65 (patch) | |
tree | ae3c6e839c6422976af55f8f0a7a77eb282733ec /src/nvim/fileio.c | |
parent | f286af170d57b85f59457ff16e6716163b69d8ba (diff) | |
download | rneovim-d07a6e2b45175439891beafc5e75f68f92eabd65.tar.gz rneovim-d07a6e2b45175439891beafc5e75f68f92eabd65.tar.bz2 rneovim-d07a6e2b45175439891beafc5e75f68f92eabd65.zip |
vim-patch:8.1.1349: if writing runs into conversion error backup file is deleted
Problem: If writing runs into a conversion error the backup file is
deleted. (Arseny Nasokin)
Solution: Don't delete the backup file is the file was overwritten and a
conversion error occurred. (Christian Brabandt, closes vim/vim#4387)
https://github.com/vim/vim/commit/cf0bfd9ade5173bcc12563bfc90c21a4db10535d
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 507bf3c032..8e4a210b66 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3693,9 +3693,11 @@ restore_backup: /* * Remove the backup unless 'backup' option is set */ - if (!p_bk && backup != NULL && os_remove((char *)backup) != 0) + if (!p_bk && backup != NULL + && !write_info.bw_conv_error + && os_remove((char *)backup) != 0) { EMSG(_("E207: Can't delete backup file")); - + } goto nofail; |