mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 06:46:07 +00:00
fix "E667: Fsync failed" on macOS
macOS: Try direct fsync() if F_FULLFSYNC fails.
closes #6725
ref https://github.com/vim/vim/pull/4016
vim-patch:8.1.0957
> on macOS F_FULLFSYNC fails with ENOTSUP for unsupported storage systems
> (e.g. SMB), though this is not documented in the Apple fcntl man page.
libuv fixed this in v1.25.0:
6fc797c3fe
This commit is contained in:
@@ -643,12 +643,19 @@ 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.
|
/// @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 os_fsync(int fd)
|
||||||
{
|
{
|
||||||
int r;
|
int r;
|
||||||
RUN_UV_FS_FUNC(r, uv_fs_fsync, fd, NULL);
|
RUN_UV_FS_FUNC(r, uv_fs_fsync, fd, NULL);
|
||||||
g_stats.fsync++;
|
g_stats.fsync++;
|
||||||
|
#ifdef __APPLE__
|
||||||
|
// TODO(justinmk): Remove this after it is fixed in libuv. #6725
|
||||||
|
if (r == UV_ENOTSUP) {
|
||||||
|
int rv = fsync(fd);
|
||||||
|
return rv ? -rv : rv;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user