diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-04-28 21:07:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 21:07:00 +0800 |
commit | 715587f8e44e941ece6f17eb77620fd1b4719496 (patch) | |
tree | 6ede3dcaf23c73e0c5ecf7a65d72364b44e1ad26 /src | |
parent | 4f235e3cafba5dc305aa0be33cdec093e9c5a92d (diff) | |
download | rneovim-715587f8e44e941ece6f17eb77620fd1b4719496.tar.gz rneovim-715587f8e44e941ece6f17eb77620fd1b4719496.tar.bz2 rneovim-715587f8e44e941ece6f17eb77620fd1b4719496.zip |
vim-patch:8.2.3509: undo file is not synced (#23371)
Problem: Undo file is not synced. (Sami Farin)
Solution: Sync the undo file if 'fsync' is set. (Christian Brabandt,
closes vim/vim#8879, closes vim/vim#8920)
https://github.com/vim/vim/commit/340dd0fbe462a15a9678cfba02085b4adcc45f02
Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/undo.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c index f4f97fd8ee..64c16ed192 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1333,6 +1333,10 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf, } #endif + if (p_fs && fflush(fp) == 0 && os_fsync(fd) != 0) { + write_ok = false; + } + write_error: fclose(fp); if (!write_ok) { |