aboutsummaryrefslogtreecommitdiff
path: root/c
diff options
context:
space:
mode:
authorEvgenii Kliuchnikov <eustas@google.com>2023-08-25 01:06:33 -0700
committerCopybara-Service <copybara-worker@google.com>2023-08-25 01:07:12 -0700
commitc1bd196833e4ce05ef49b82ec5e124bb79e095ff (patch)
treee7303c45defffa30b8d531a737137de7fb10ad8f /c
parent2a5a088b03ba5fd3aab4f34338c84e2c61d82c49 (diff)
downloadbrotli-c1bd196833e4ce05ef49b82ec5e124bb79e095ff.zip
brotli-c1bd196833e4ce05ef49b82ec5e124bb79e095ff.tar.gz
brotli-c1bd196833e4ce05ef49b82ec5e124bb79e095ff.tar.bz2
comb HAVE_UTIMENSAT definition
PiperOrigin-RevId: 560011681
Diffstat (limited to 'c')
-rw-r--r--c/tools/brotli.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/c/tools/brotli.c b/c/tools/brotli.c
index 432fa52..03f2d06 100644
--- a/c/tools/brotli.c
+++ b/c/tools/brotli.c
@@ -75,17 +75,23 @@ static int ms_open(const char* filename, int oflag, int pmode) {
#define MAKE_BINARY(FILENO) (FILENO)
#endif /* defined(_WIN32) */
-#if defined(__APPLE__) && !defined(_POSIX_C_SOURCE)
+#if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200809L)
#define HAVE_UTIMENSAT 1
+#elif defined(_ATFILE_SOURCE)
+#define HAVE_UTIMENSAT 1
+#else
+#define HAVE_UTIMENSAT 0
+#endif
+
+#if HAVE_UTIMENSAT
+#if defined(__APPLE__)
#define ATIME_NSEC(S) ((S)->st_atimespec.tv_nsec)
#define MTIME_NSEC(S) ((S)->st_mtimespec.tv_nsec)
-#elif defined(_WIN32) || !defined(AT_SYMLINK_NOFOLLOW)
-#define HAVE_UTIMENSAT 0
-#else
-#define HAVE_UTIMENSAT 1
+#else /* defined(__APPLE__) */
#define ATIME_NSEC(S) ((S)->st_atim.tv_nsec)
#define MTIME_NSEC(S) ((S)->st_mtim.tv_nsec)
#endif
+#endif /* HAVE_UTIMENSAT */
typedef enum {
COMMAND_COMPRESS,