Skip to content

Commit 844d650

Browse files
eklitzkeluke-jr
authored andcommitted
util: Prefer Mac-specific F_FULLSYNC over fdatasync in FileCommit
1 parent f6cec0b commit 844d650

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/util/system.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,16 +1024,16 @@ bool FileCommit(FILE *file)
10241024
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
10251025
return false;
10261026
}
1027-
#elif HAVE_FDATASYNC
1028-
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
1029-
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
1030-
return false;
1031-
}
10321027
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
10331028
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
10341029
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
10351030
return false;
10361031
}
1032+
#elif HAVE_FDATASYNC
1033+
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
1034+
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
1035+
return false;
1036+
}
10371037
#else
10381038
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
10391039
LogPrintf("%s: fsync failed: %d\n", __func__, errno);

0 commit comments

Comments
 (0)