aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2012-09-28 14:27:20 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2012-10-07 15:51:40 +0200
commite9965213907bf5dee4ae54be38f9c048aa124644 (patch)
treece29a9301628324db4f79a7b4178fcd2b877583b
parentee0b64853699c08602fed81cdefc62d7e8dcdce2 (diff)
Use fdatasync instead of fsync on supported platforms
-rw-r--r--src/util.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index 296842acc3..e58001842e 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -1112,7 +1112,11 @@ void FileCommit(FILE *fileout)
#ifdef WIN32
_commit(_fileno(fileout));
#else
+ #if defined(__linux__) || defined(__NetBSD__)
+ fdatasync(fileno(fileout));
+ #else
fsync(fileno(fileout));
+ #endif
#endif
}