Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fdatasync() is not available on macOS #1304

Open
moubctez opened this issue Oct 3, 2024 · 1 comment
Open

fdatasync() is not available on macOS #1304

moubctez opened this issue Oct 3, 2024 · 1 comment

Comments

@moubctez
Copy link

moubctez commented Oct 3, 2024

Building rtorrent 0.14.0 fails on macOS, because fdatasync() is not available.

I propose this fix:

--- src/core/download_store.cc.orig	2024-10-03 17:46:35.720389128 +0000
+++ src/core/download_store.cc
@@ -129,7 +129,11 @@ DownloadStore::write_bencode(const std::
   if (fd < 0)
     goto download_store_save_error;
 
+#if defined(_POSIX_SYNCHRONIZED_IO) && _POSIX_SYNCHRONIZED_IO > 0
   fdatasync(fd);
+#else
+  fsync(fd);
+#endif
   ::close(fd);
 
   return true;

It is based on Qt, as described there: https://gitlab.freedesktop.org/xdg/shared-mime-info/-/issues/7

@stickz
Copy link
Contributor

stickz commented Oct 5, 2024

This is the fix we want: #1297

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants