Mercurial > vim
comparison src/fileio.c @ 16694:ed9b15758241 v8.1.1349
patch 8.1.1349: if writing runs into conversion error backup file is deleted
commit https://github.com/vim/vim/commit/cf0bfd9ade5173bcc12563bfc90c21a4db10535d
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 18 18:52:04 2019 +0200
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 #4387)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 18 May 2019 19:00:05 +0200 |
parents | 4e9bea9b8025 |
children | e42e9fa83e60 |
comparison
equal
deleted
inserted
replaced
16693:66aafdc47517 | 16694:ed9b15758241 |
---|---|
4983 mch_setperm((char_u *)org, mch_getperm(fname) & 0777); | 4983 mch_setperm((char_u *)org, mch_getperm(fname) & 0777); |
4984 vim_free(org); | 4984 vim_free(org); |
4985 } | 4985 } |
4986 } | 4986 } |
4987 | 4987 |
4988 /* | 4988 // Remove the backup unless 'backup' option is set or there was a |
4989 * Remove the backup unless 'backup' option is set | 4989 // conversion error. |
4990 */ | 4990 if (!p_bk && backup != NULL && !write_info.bw_conv_error |
4991 if (!p_bk && backup != NULL && mch_remove(backup) != 0) | 4991 && mch_remove(backup) != 0) |
4992 emsg(_("E207: Can't delete backup file")); | 4992 emsg(_("E207: Can't delete backup file")); |
4993 | 4993 |
4994 goto nofail; | 4994 goto nofail; |
4995 | 4995 |
4996 /* | 4996 /* |