aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorfanquake <[email protected]>2020-07-28 19:55:00 +0800
committerfanquake <[email protected]>2020-07-28 22:39:56 +0800
commit1d8338d6b71447a5bf18750ca44724345aae5b60 (patch)
tree6bf4e53bd468cfb6f634f1343430ef9100edb4c2 /src/util
parentMerge #19519: ci: Increase CCACHE_SIZE in some builds on Travis (diff)
downloaddiscoin-1d8338d6b71447a5bf18750ca44724345aae5b60.tar.xz
discoin-1d8338d6b71447a5bf18750ca44724345aae5b60.zip
util: use HAVE_FDATASYNC to determine fdatasync() use
Rather than just using it on Linux and NetBSD, use `fdatasync()` based on whether it's available. i.e it is available in newer versions of FreeBSD (11.1 and later). This also aligns our code more closely with what is being done in leveldb. Was pointed out by Luke in #19430.
Diffstat (limited to 'src/util')
-rw-r--r--src/util/system.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 8164e884b..e63f2e5c7 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1021,7 +1021,7 @@ bool FileCommit(FILE *file)
return false;
}
#else
- #if defined(__linux__) || defined(__NetBSD__)
+ #if defined(HAVE_FDATASYNC)
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
return false;