From fcbe8c639d60c4ed844204e7291746220de0b2ee Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 7 Dec 2018 18:03:23 -0800 Subject: macOS: fix code using POSIX 2008 `st_[acm]tim` fields. Hopefully they'll fix this properly at some point, but until then... --- lib/portability.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib') diff --git a/lib/portability.h b/lib/portability.h index 60d40498..48cb490a 100644 --- a/lib/portability.h +++ b/lib/portability.h @@ -7,6 +7,17 @@ // For musl #define _ALL_SOURCE +#ifdef __APPLE__ +// macOS 10.13 doesn't have the POSIX 2008 direct access to timespec in +// struct stat, but we can ask it to give us something equivalent... +// (This must come before any #include!) +#define _DARWIN_C_SOURCE +// ...and then use macros to paper over the difference. +#define st_atim st_atimespec +#define st_ctim st_ctimespec +#define st_mtim st_mtimespec +#endif + // Test for gcc (using compiler builtin #define) #ifdef __GNUC__ -- cgit v1.2.3