summaryrefslogtreecommitdiff
path: root/include/share/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/share/compat.h')
-rw-r--r--include/share/compat.h10
1 files changed, 9 insertions, 1 deletions
diff --git a/include/share/compat.h b/include/share/compat.h
index f3041655..c28054be 100644
--- a/include/share/compat.h
+++ b/include/share/compat.h
@@ -112,9 +112,13 @@
#include <sys/utime.h> /* for utime() */
#endif
#else
+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
+#include <fcntl.h>
+#else
#include <sys/types.h> /* some flavors of BSD (like OS X) require this to get time_t */
#include <utime.h> /* for utime() */
#endif
+#endif
#if defined _MSC_VER
# if _MSC_VER >= 1800
@@ -160,11 +164,15 @@
#define flac_fopen fopen
#define flac_chmod chmod
-#define flac_utime utime
#define flac_unlink unlink
#define flac_rename rename
#define flac_stat stat
+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
+#define flac_utime(a, b) utimensat (AT_FDCWD, a, *b, 0)
+#else
+#define flac_utime utime
+#endif
#endif
#ifdef _WIN32