@@ -940,7 +940,8 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
COMPILER_CHECK(sizeof(__sanitizer_dirent) <= sizeof(dirent));
CHECK_SIZE_AND_OFFSET(dirent, d_ino);
-#if SANITIZER_MAC
+#if SANITIZER_MAC && __DARWIN_64_BIT_INO_T
+// The 'd_seekoff' field is only present on OS X for 64-bit builds
CHECK_SIZE_AND_OFFSET(dirent, d_seekoff);
#elif SANITIZER_FREEBSD
// There is no 'd_off' field on FreeBSD.
@@ -392,12 +392,21 @@ namespace __sanitizer {
#endif
#if SANITIZER_MAC
+# if __DARWIN_64_BIT_INO_T
struct __sanitizer_dirent {
unsigned long long d_ino;
unsigned long long d_seekoff;
unsigned short d_reclen;
// more fields that we don't care about
};
+# else
+ struct __sanitizer_dirent {
+ unsigned int d_ino;
+ // No d_seekoff for 32-bit
+ unsigned short d_reclen;
+ // more fields that we don't care about
+ };
+# endif
#elif SANITIZER_FREEBSD
struct __sanitizer_dirent {
unsigned int d_fileno;