Skip to content

Commit 1d8338d

Browse files
committed
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.
1 parent 24ead1a commit 1d8338d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/util/system.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ bool FileCommit(FILE *file)
10211021
return false;
10221022
}
10231023
#else
1024-
#if defined(__linux__) || defined(__NetBSD__)
1024+
#if defined(HAVE_FDATASYNC)
10251025
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
10261026
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
10271027
return false;

0 commit comments

Comments
 (0)