os0file.c:

  Use the fcntl() file flush method on OS X; Apple disabled fsync() for internal disk drives, which caused corruption in power outages; the patch was recommended by an Apple engineer
parent 9fe6813a
...@@ -1763,7 +1763,21 @@ os_file_flush( ...@@ -1763,7 +1763,21 @@ os_file_flush(
#else #else
int ret; int ret;
#ifdef HAVE_FDATASYNC #ifdef HAVE_DARWIN_THREADS
/* Apple has disabled fsync() for internal disk drives in OS X. That
caused corruption for a user when he tested a power outage. Let us in
OS X use a nonstandard flush method recommended by an Apple
engineer. */
ret = fcntl(file, F_FULLFSYNC, NULL);
if (ret) {
/* If we are not on a file system that supports this, then
fall back to a plain fsync. */
ret = fsync(file);
}
#elif HAVE_FDATASYNC
ret = fdatasync(file); ret = fdatasync(file);
#else #else
/* fprintf(stderr, "Flushing to file %p\n", file); */ /* fprintf(stderr, "Flushing to file %p\n", file); */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment