aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/options.txt4
-rw-r--r--src/nvim/undo.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 0aa6769f4e..ba73d79cd3 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -2774,8 +2774,8 @@ A jump table for the options with a short description can be found at |Q_op|.
'fsync' 'fs' boolean (default off)
global
When on, the OS function fsync() will be called after saving a file
- (|:write|, |writefile()|, …), |swap-file| and |shada-file|. This
- flushes the file to disk, ensuring that it is safely written.
+ (|:write|, |writefile()|, …), |swap-file|, |undo-persistence| and |shada-file|.
+ This flushes the file to disk, ensuring that it is safely written.
Slow on some systems: writing buffers, quitting Nvim, and other
operations may sometimes take a few seconds.
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) {