From 85e1a565606d04626966321f63db53005d4b162b Mon Sep 17 00:00:00 2001 From: ZyX Date: Sat, 30 Jul 2016 18:14:04 +0300 Subject: os/fileio: Allow certain failures during file_fsync MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/nvim/os/fileio.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') 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 -- cgit