aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-02-21 19:38:24 +0100
committerGitHub <noreply@github.com>2019-02-21 19:38:24 +0100
commit0be6d3c86fe583860e0e70cbf46b4e4c5231f891 (patch)
treed9c16d4750dc98b8af6109faf3283e254b6a119f /src
parent40f5a6c4dafe4bbca227d4c6bda0d9a94d817d71 (diff)
parent996916277d9845b61f026c53197880889e5004e2 (diff)
downloadrneovim-0be6d3c86fe583860e0e70cbf46b4e4c5231f891.tar.gz
rneovim-0be6d3c86fe583860e0e70cbf46b4e4c5231f891.tar.bz2
rneovim-0be6d3c86fe583860e0e70cbf46b4e4c5231f891.zip
Merge #9634 'fsync: Ignore ENOTSUP. Fix writing to SMB.'
Diffstat (limited to 'src')
-rw-r--r--src/nvim/event/socket.c2
-rw-r--r--src/nvim/fileio.c4
-rw-r--r--src/nvim/os/fileio.c5
-rw-r--r--src/nvim/os/fs.c2
4 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/event/socket.c b/src/nvim/event/socket.c
index 6fcb9f7e7a..af326f9c82 100644
--- a/src/nvim/event/socket.c
+++ b/src/nvim/event/socket.c
@@ -169,7 +169,7 @@ void socket_watcher_close(SocketWatcher *watcher, socket_close_cb cb)
FUNC_ATTR_NONNULL_ARG(1)
{
watcher->close_cb = cb;
- uv_close((uv_handle_t *)watcher->stream, close_cb);
+ uv_close(STRUCT_CAST(uv_handle_t, watcher->stream), close_cb);
}
static void connection_event(void **argv)
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;
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 9a4391a0ae..99ece275b1 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -643,7 +643,7 @@ ptrdiff_t os_write(const int fd, const char *const buf, const size_t size,
///
/// @param fd the file descriptor of the file to flush to disk.
///
-/// @return `0` on success, a libuv error code on failure.
+/// @return 0 on success, or libuv error code on failure.
int os_fsync(int fd)
{
int r;