[Toybox] [PATCH] macOS: fix code using POSIX 2008 `st_[acm]tim` fields.

enh enh at google.com
Fri Dec 7 18:16:59 PST 2018


Hopefully they'll fix this properly at some point, but until then...
---
 lib/portability.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/lib/portability.h b/lib/portability.h
index 21d0b8a1..ad7965ec 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__
-- 
2.19.0.605.g01d371f741-goog
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-macOS-fix-code-using-POSIX-2008-st_-acm-tim-fields.patch
Type: application/octet-stream
Size: 1035 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20181207/c4e3075e/attachment-0002.obj>


More information about the Toybox mailing list