From 996916277d9845b61f026c53197880889e5004e2 Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Wed, 20 Feb 2019 21:52:12 +0100 Subject: I/O: ignore ENOTSUP for failed fsync() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Suggested by ZyX in https://github.com/neovim/neovim/issues/6725#issuecomment-312197691 : > There already is an exception if writing to a “device” (e.g. FIFO). > It makes sense to ignore certain errors like ENOTSUP or EOPNOTSUPP > since it is not something we or user can do anything about. ref #6725 --- src/nvim/fileio.c | 4 +++- src/nvim/os/fileio.c | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 6356290b9c..ba3625bf95 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -3405,7 +3405,9 @@ restore_backup: // (could be a pipe). // If the 'fsync' option is FALSE, don't fsync(). Useful for laptops. int error; - if (p_fs && (error = os_fsync(fd)) != 0 && !device) { + if (p_fs && (error = os_fsync(fd)) != 0 && !device + // fsync not supported on this storage. + && error != UV_ENOTSUP) { SET_ERRMSG_ARG(_("E667: Fsync failed: %s"), error); end = 0; } diff --git a/src/nvim/os/fileio.c b/src/nvim/os/fileio.c index ccf35fd57c..bb68326a03 100644 --- a/src/nvim/os/fileio.c +++ b/src/nvim/os/fileio.c @@ -229,7 +229,10 @@ int file_fsync(FileDescriptor *const fp) return flush_error; } const int fsync_error = os_fsync(fp->fd); - if (fsync_error != UV_EINVAL && fsync_error != UV_EROFS) { + if (fsync_error != UV_EINVAL + && fsync_error != UV_EROFS + // fsync not supported on this storage. + && fsync_error != UV_ENOTSUP) { return fsync_error; } return 0; -- cgit