special case fdatasync check on apple

fixes #375
This commit is contained in:
Valient Gough 2017-08-08 00:26:01 -04:00
parent d820f708ad
commit 91e183fb85
No known key found for this signature in database
GPG Key ID: 33C65E29813C14DF
2 changed files with 7 additions and 2 deletions

View File

@ -97,7 +97,12 @@ check_cxx_source_compiles ("#include <sys/types.h>
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)

View File

@ -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 {