aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2020-08-20 17:41:54 +0000
committerLuke Dashjr <luke-jr+git@utopios.org>2020-08-25 16:46:00 +0000
commitc4b85ba704a1b5257dc82786a84f676bacb7b027 (patch)
tree7db5f43275d2cfdb9103cca6569e161792061b39
parente9b30126545d6ddd8772363e4079d1e4908ad117 (diff)
downloadbitcoin-c4b85ba704a1b5257dc82786a84f676bacb7b027.tar.xz
Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB
-rw-r--r--configure.ac2
-rw-r--r--src/util/system.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index 3ab97eb531..ee6c6962e1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1039,13 +1039,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
[ AC_MSG_RESULT(no)]
)
-dnl LevelDB platform checks
AC_MSG_CHECKING(for fdatasync)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
[[ fdatasync(0); ]])],
[ AC_MSG_RESULT(yes); HAVE_FDATASYNC=1 ],
[ AC_MSG_RESULT(no); HAVE_FDATASYNC=0 ]
)
+AC_DEFINE_UNQUOTED([HAVE_FDATASYNC], [$HAVE_FDATASYNC], [Define to 1 if fdatasync is available.])
AC_MSG_CHECKING(for F_FULLFSYNC)
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
diff --git a/src/util/system.cpp b/src/util/system.cpp
index 7b74789b32..f5931b5ff1 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1025,7 +1025,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;