On Mac OS X fsync does not guarantee write to disk. Use fcntl F_FULLFSYNC instead.