Skip to content

Commit e3272ff

Browse files
committed
Merge #19614: util: use HAVE_FDATASYNC to determine fdatasync() use
1d8338d util: use HAVE_FDATASYNC to determine fdatasync() use (fanquake) Pull request description: Rather than just using on Linux and NetBSD, use `fdatasync()` based on whether it's available. i.e `fdatasync` is available in newer versions of FreeBSD. This also aligns more closely with what is being done in leveldb. Was pointed out by Luke in #19430. ACKs for top commit: practicalswift: ACK 1d8338d -- patch looks correct laanwj: ACK 1d8338d hebasto: ACK 1d8338d Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
2 parents 4644b13 + 1d8338d commit e3272ff

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
@@ -1025,7 +1025,7 @@ bool FileCommit(FILE *file)
10251025
return false;
10261026
}
10271027
#else
1028-
#if defined(__linux__) || defined(__NetBSD__)
1028+
#if defined(HAVE_FDATASYNC)
10291029
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
10301030
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
10311031
return false;

0 commit comments

Comments
 (0)