aboutsummaryrefslogtreecommitdiff
path: root/src/util/system.cpp
diff options
context:
space:
mode:
authorEvan Klitzke <evan@eklitzke.org>2018-03-15 06:54:11 -0700
committerLuke Dashjr <luke-jr+git@utopios.org>2020-08-25 16:46:20 +0000
commitf6cec0bcaf560fa310853ad3fe17022602b63d5f (patch)
treeec9bf629ab6e2d5ec52b5ab9a18f28fe2dfe86a1 /src/util/system.cpp
parentc4b85ba704a1b5257dc82786a84f676bacb7b027 (diff)
downloadbitcoin-f6cec0bcaf560fa310853ad3fe17022602b63d5f.tar.xz
util: Refactor FileCommit from an #if sequence nested in #else, to a sequence of #elif
This should not change the actual code generation.
Diffstat (limited to 'src/util/system.cpp')
-rw-r--r--src/util/system.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/util/system.cpp b/src/util/system.cpp
index f5931b5ff1..2dbf13f6b5 100644
--- a/src/util/system.cpp
+++ b/src/util/system.cpp
@@ -1024,23 +1024,21 @@ bool FileCommit(FILE *file)
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
return false;
}
-#else
- #if HAVE_FDATASYNC
+#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
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
return false;
}
- #else
+#else
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
return false;
}
- #endif
#endif
return true;
}