diff options
author | fanquake <fanquake@gmail.com> | 2020-08-31 12:43:19 +0800 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2020-08-31 13:07:24 +0800 |
commit | 0adb80fe630ccaf3ab4577ad1070d35c2dd807d8 (patch) | |
tree | 13527b1aacd98c735cafca11c9fe9d8902847b8f /src/util | |
parent | 21eda43cdea808335385af5c35f3baa77239749c (diff) | |
parent | c4b85ba704a1b5257dc82786a84f676bacb7b027 (diff) |
Merge #19803: Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB
c4b85ba704a1b5257dc82786a84f676bacb7b027 Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB (Luke Dashjr)
Pull request description:
Fixes a bug introduced in #19614
The LevelDB-specific fdatasync check was only using `AC_SUBST`, which works for Makefiles, but doesn't define anything for C++. Furthermore, the #define is typically 0 or 1, never undefined.
This fixes both issues by defining it and checking its value instead of whether it is merely defined.
Pulled out of #14501 by fanquake's request
ACKs for top commit:
fanquake:
ACK c4b85ba704a1b5257dc82786a84f676bacb7b027 - thanks for catching and fixing my mistake.
laanwj:
Code review ACK c4b85ba704a1b5257dc82786a84f676bacb7b027
Tree-SHA512: 91d5d426ba000b4f3ee7e2315635e24bbb23ceff16269ddf4f65a63d25fc9e9cf94a3b236eed2f8031cc36ddcf78aeb5916efcb244f415943a8a12f907ede8f9
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/system.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp index 00aa53df70..999937d906 100644 --- a/src/util/system.cpp +++ b/src/util/system.cpp @@ -1019,7 +1019,7 @@ bool FileCommit(FILE *file) return false; } #else - #if defined(HAVE_FDATASYNC) + #if 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; |