diff --git a/CMakeLists.txt b/CMakeLists.txt index ad1dd54..bceacec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -97,7 +97,12 @@ check_cxx_source_compiles ("#include include (CheckFuncs) check_function_exists_glibc (lchmod HAVE_LCHMOD) check_function_exists_glibc (utimensat HAVE_UTIMENSAT) -check_function_exists_glibc (fdatasync HAVE_FDATASYNC) +if (APPLE) + message ("-- There is no usable FDATASYNC on Apple") + set(HAVE_FDATASYNC FALSE) +else() + check_function_exists_glibc (fdatasync HAVE_FDATASYNC) +endif (APPLE) set (CMAKE_THREAD_PREFER_PTHREAD) find_package (Threads REQUIRED) diff --git a/encfs/FileNode.cpp b/encfs/FileNode.cpp index 4ae65a7..33fb132 100644 --- a/encfs/FileNode.cpp +++ b/encfs/FileNode.cpp @@ -258,7 +258,7 @@ int FileNode::sync(bool datasync) { int fh = io->open(O_RDONLY); if (fh >= 0) { int res = -EIO; -#ifdef linux +#if defined(HAVE_FDATASYNC) if (datasync) { res = fdatasync(fh); } else {