diff options
author | ZyX <kp-pav@yandex.ru> | 2016-07-30 18:14:04 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-02-14 01:09:59 +0300 |
commit | 85e1a565606d04626966321f63db53005d4b162b (patch) | |
tree | c60ed34557f6cd27874e69c0aecad229e8039826 /src | |
parent | 4a511de881efcf9b759c7babdeb0e31242d62c2e (diff) | |
download | rneovim-85e1a565606d04626966321f63db53005d4b162b.tar.gz rneovim-85e1a565606d04626966321f63db53005d4b162b.tar.bz2 rneovim-85e1a565606d04626966321f63db53005d4b162b.zip |
os/fileio: Allow certain failures during file_fsync
According to the documentation fsync() may fail with EROFS or EINVAL if “file
descriptor is bound to a special file which does not support synchronization”
(e.g. /dev/stderr). This condition is completely valid in this case since main
point of `file_fsync()` is dumping buffered input.
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/os/fileio.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index cf5bfd60ae..02b471ef7e 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -153,7 +153,11 @@ int file_fsync(FileDescriptor *const fp) fp->_error = 0; return error; } - return os_fsync(fp->fd); + const int error = os_fsync(fp->fd); + if (error != UV_EINVAL && error != UV_EROFS) { + return error; + } + return 0; } /// Buffer used for writing |