diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-01-01 12:13:40 -0500 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-01-01 12:13:40 -0500 |
commit | df4ac79761162313de4e27a265044125062013cf (patch) | |
tree | f29cc5366be73b1ec58e29e0cb50b407b27a1e8c /src/nvim/fileio.c | |
parent | a79ebeeea469958a2f56096dcfc878da7cf790d6 (diff) | |
parent | 648aebb8b6dcf28c85477398572e5552062ceb18 (diff) | |
download | rneovim-df4ac79761162313de4e27a265044125062013cf.tar.gz rneovim-df4ac79761162313de4e27a265044125062013cf.tar.bz2 rneovim-df4ac79761162313de4e27a265044125062013cf.zip |
Merge pull request #3911 from sethjackson/have-fsync-guard
os_fsync
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 1a6c85abaa..58269983c5 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3368,16 +3368,16 @@ restore_backup: nchars += len; } -#if defined(UNIX) && defined(HAVE_FSYNC) - /* On many journalling file systems there is a bug that causes both the - * original and the backup file to be lost when halting the system right - * after writing the file. That's because only the meta-data is - * journalled. Syncing the file slows down the system, but assures it has - * been written to disk and we don't lose it. - * For a device do try the fsync() but don't complain if it does not work - * (could be a pipe). - * If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. */ - if (p_fs && fsync(fd) != 0 && !device) { +#if defined(UNIX) + // On many journalling file systems there is a bug that causes both the + // original and the backup file to be lost when halting the system right + // after writing the file. That's because only the meta-data is + // journalled. Syncing the file slows down the system, but assures it has + // been written to disk and we don't lose it. + // For a device do try the fsync() but don't complain if it does not work + // (could be a pipe). + // If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. + if (p_fs && os_fsync(fd) != 0 && !device) { errmsg = (char_u *)_("E667: Fsync failed"); end = 0; } |