Skip to content

Commit f6cec0b

Browse files
eklitzkeluke-jr
authored andcommitted
util: Refactor FileCommit from an #if sequence nested in #else, to a sequence of #elif
This should not change the actual code generation.
1 parent c4b85ba commit f6cec0b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

src/util/system.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,23 +1024,21 @@ bool FileCommit(FILE *file)
10241024
LogPrintf("%s: FlushFileBuffers failed: %d\n", __func__, GetLastError());
10251025
return false;
10261026
}
1027-
#else
1028-
#if HAVE_FDATASYNC
1027+
#elif HAVE_FDATASYNC
10291028
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
10301029
LogPrintf("%s: fdatasync failed: %d\n", __func__, errno);
10311030
return false;
10321031
}
1033-
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
1032+
#elif defined(MAC_OSX) && defined(F_FULLFSYNC)
10341033
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
10351034
LogPrintf("%s: fcntl F_FULLFSYNC failed: %d\n", __func__, errno);
10361035
return false;
10371036
}
1038-
#else
1037+
#else
10391038
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
10401039
LogPrintf("%s: fsync failed: %d\n", __func__, errno);
10411040
return false;
10421041
}
1043-
#endif
10441042
#endif
10451043
return true;
10461044
}

0 commit comments

Comments
 (0)