mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
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.
This commit is contained in:
parent
24ead1a923
commit
1d8338d6b7
1 changed files with 1 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue