# HG changeset patch # User mas01cr # Date 1245322891 0 # Node ID c6036e0a511a9de6187dc1c2f6767ae577672136 # Parent dfeb5ef768dabe86d0f60d0e456792227001f179 Work around the non-universality of fdatasync() POSIX, which specifies fdatasync(), also apparently specifies that POSIX_SYNCHRONIZED_IO is defined to a non-zero value if fdatasync() is available -- or at least that's what the man page suggests on Linux. This is probably good enough for us, anyway. diff -r dfeb5ef768da -r c6036e0a511a audioDB-internals.h --- a/audioDB-internals.h Fri Apr 17 16:52:15 2009 +0000 +++ b/audioDB-internals.h Thu Jun 18 11:01:31 2009 +0000 @@ -1,3 +1,6 @@ +#include +#include + #include #include #include @@ -179,8 +182,11 @@ goto error; } - /* can be fsync() if fdatasync() is racily exciting and new */ +#if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0) fdatasync(adb->fd); +#else + fsync(adb->fd); +#endif if(lseek(adb->fd, pos, SEEK_SET) == (off_t) -1) { goto error; }