mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-06-06 05:00:12 +02:00
util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit
This commit is contained in:
parent
f6cec0bcaf
commit
844d650eea
@ -1024,16 +1024,16 @@ bool FileCommit(FILE *file)
|
|||||||
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
|
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif 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;
|
|
||||||
}
|
|
||||||
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
|
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
|
||||||
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
|
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
|
||||||
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
|
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#elif 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;
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
|
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
|
||||||
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
|
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user