Use F_FULLFSYNC instead of fsync on Darwin.

GitOrigin-RevId: 05a7bc0683641a679b026b6d636fa127fe104123
This commit is contained in:
levlam 2019-02-22 04:20:23 +03:00
parent bedd80c23a
commit 272608a5fb

View File

@ -468,7 +468,11 @@ Stat FileFd::stat() {
Status FileFd::sync() {
CHECK(!empty());
#if TD_PORT_POSIX
#if TD_DARWIN
if (fcntl(get_native_fd().fd(), F_FULLFSYNC) == -1) {
#else
if (fsync(get_native_fd().fd()) != 0) {
#endif
#elif TD_PORT_WINDOWS
if (FlushFileBuffers(get_native_fd().fd()) == 0) {
#endif