Bugfix: Define and use HAVE_FDATASYNC correctly outside LevelDB

This commit is contained in:
Luke Dashjr 2020-08-20 17:41:54 +00:00
parent e9b3012654
commit c4b85ba704
2 changed files with 2 additions and 2 deletions

View File

@ -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>]],

View File

@ -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;