diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-05-18 18:52:04 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-05-18 18:52:04 +0200 |
commit | cf0bfd9ade5173bcc12563bfc90c21a4db10535d (patch) | |
tree | 189907ca3e0ce6ca8d73adb3cc96ddd2cbb47275 /src/fileio.c | |
parent | f8191c5f07c650b75b85c5a5b3d000fd5cae1643 (diff) | |
download | vim-git-cf0bfd9ade5173bcc12563bfc90c21a4db10535d.tar.gz |
patch 8.1.1349: if writing runs into conversion error backup file is deletedv8.1.1349
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 #4387)
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c index 659878eb9..4d9cd05f0 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -4985,10 +4985,10 @@ restore_backup: } } - /* - * Remove the backup unless 'backup' option is set - */ - if (!p_bk && backup != NULL && mch_remove(backup) != 0) + // Remove the backup unless 'backup' option is set or there was a + // conversion error. + if (!p_bk && backup != NULL && !write_info.bw_conv_error + && mch_remove(backup) != 0) emsg(_("E207: Can't delete backup file")); goto nofail; |