mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-22 06:52:36 +01:00
Merge #19803: Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB
c4b85ba704
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: ACKc4b85ba704
- thanks for catching and fixing my mistake. laanwj: Code review ACKc4b85ba704
Tree-SHA512: 91d5d426ba000b4f3ee7e2315635e24bbb23ceff16269ddf4f65a63d25fc9e9cf94a3b236eed2f8031cc36ddcf78aeb5916efcb244f415943a8a12f907ede8f9
This commit is contained in:
commit
0adb80fe63
2 changed files with 2 additions and 2 deletions
|
@ -1047,13 +1047,13 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdint.h>
|
||||||
[ AC_MSG_RESULT(no)]
|
[ AC_MSG_RESULT(no)]
|
||||||
)
|
)
|
||||||
|
|
||||||
dnl LevelDB platform checks
|
|
||||||
AC_MSG_CHECKING(for fdatasync)
|
AC_MSG_CHECKING(for fdatasync)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <unistd.h>]],
|
||||||
[[ fdatasync(0); ]])],
|
[[ fdatasync(0); ]])],
|
||||||
[ AC_MSG_RESULT(yes); HAVE_FDATASYNC=1 ],
|
[ AC_MSG_RESULT(yes); HAVE_FDATASYNC=1 ],
|
||||||
[ AC_MSG_RESULT(no); HAVE_FDATASYNC=0 ]
|
[ 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_MSG_CHECKING(for F_FULLFSYNC)
|
||||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <fcntl.h>]],
|
||||||
|
|
|
@ -1019,7 +1019,7 @@ bool FileCommit(FILE *file)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if defined(HAVE_FDATASYNC)
|
#if HAVE_FDATASYNC
|
||||||
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
|
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
|
||||||
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
|
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Add table
Reference in a new issue