on master help sign in
drop HAVE_FDATASYNC in preference to HOST_OS checks

HAVE_FDATASYNC does not appear to be defined on linux while the unix module does not complain that it is missing (it is not)

commit04732c3505f4349bd22bec4b51ccc485372cf41c authorAgentM <agentm@themactionfaction.com> dateSun 2 Apr 2017, 18:21 (10 years ago) parent542b859
1 file changed+6−4
src/lib/ProjectM36/Persist.hs+6−4
src/lib/ProjectM36/Persist.hs+6−4
@@ -10,10 +10,11 @@ module ProjectM36.Persist (writeFileSync,
1010import qualified System.Win32 as Win32
1111#else
1212import qualified System.Posix as Posix
13− #ifdef HAVE_FDATASYNC
13+#if defined(linux_HOST_OS)
1414import System.Posix.Unistd (fileSynchroniseDataOnly)
15− #endif
15+#else
1616import System.Posix.Unistd (fileSynchronise)
17+#endif
1718import System.Posix.IO (handleToFd)
1819import Foreign.C
1920#endif
@@ -54,9 +55,10 @@ syncHandle :: DiskSync -> Handle -> IO ()
5455syncHandle FsyncDiskSync handle = do
5556#if defined(mingw32_HOST_OS)
5657 withHandleToHANDLE handle (\h -> Win32.flushFileBuffers h)
57−#elif HAVE_FDATASYNC
58+#elif defined(linux_HOST_OS)
59+ --fdatasync doesn't exist on macOS
5860 handleToFd handle >>= fileSynchroniseDataOnly
59−#else
61+#else
6062 handleToFd handle >>= fileSynchronise
6163#endif
6264syncHandle NoDiskSync _ = pure ()