Skip to content

Commit

Permalink
Merge bitcoin#19614: util: use HAVE_FDATASYNC to determine fdatasync(…
Browse files Browse the repository at this point in the history
…) 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 bitcoin#19430.

ACKs for top commit:
  practicalswift:
    ACK 1d8338d -- patch looks correct
  laanwj:
    ACK 1d8338d
  hebasto:
    ACK 1d8338d

Tree-SHA512: 7dd6d87f5dc0c0ba21ae42f96b63fc12b34806cd536457fc4284f14bb8c235765344be228b000c6adf4cd1e8c4e6a03a18ca18ab22599c42cc3b706e0bcd1a17
  • Loading branch information
laanwj committed Aug 5, 2020
2 parents 4644b13 + 1d8338d commit e3272ff
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/util/system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,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;
Expand Down

0 comments on commit e3272ff

Please sign in to comment.