Skip to content

Commit

Permalink
On Mac OS X fsync does not guarantee write to disk. Use fcntl F_FULLF…
Browse files Browse the repository at this point in the history
…SYNC instead.
  • Loading branch information
dpkp authored and sipa committed Aug 20, 2013
1 parent a02ddf9 commit be1b0ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion port/port_posix.h
Expand Up @@ -62,12 +62,16 @@
#define fflush_unlocked fflush
#endif

#if defined(OS_MACOSX) || defined(OS_FREEBSD) ||\
#if defined(OS_FREEBSD) ||\
defined(OS_OPENBSD) || defined(OS_DRAGONFLYBSD)
// Use fsync() on platforms without fdatasync()
#define fdatasync fsync
#endif

#if defined(OS_MACOSX)
#define fdatasync(fd) fcntl(fd, F_FULLFSYNC, 0)
#endif

#if defined(OS_ANDROID) && __ANDROID_API__ < 9
// fdatasync() was only introduced in API level 9 on Android. Use fsync()
// when targetting older platforms.
Expand Down

0 comments on commit be1b0ff

Please sign in to comment.