cli: preserve sub-second mtime on the BSDs (fixes #1515) HAVE_UTIMENSAT was only set when _POSIX_C_SOURCE >= 200809L or _ATFILE_SOURCE was defined. FreeBSD, OpenBSD, NetBSD and DragonFly BSD provide utimensat()/futimens() and nanosecond-resolution stat timestamps by default without defining either macro, so the CLI fell back to utime() and truncated the copied mtime to whole seconds (visible as .br files with a .000000000 nanosecond field next to the source). Detect those platforms explicitly. The existing non-Apple ATIME_NSEC / MTIME_NSEC macros already use the st_atim / st_mtim spelling that the BSDs expose, so no further change is needed.
diff --git a/c/tools/brotli.c b/c/tools/brotli.c index 98ff0a4..5554ced 100644 --- a/c/tools/brotli.c +++ b/c/tools/brotli.c
@@ -79,6 +79,9 @@ #define HAVE_UTIMENSAT 1 #elif defined(_ATFILE_SOURCE) #define HAVE_UTIMENSAT 1 +#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || \ + defined(__DragonFly__) +#define HAVE_UTIMENSAT 1 #else #define HAVE_UTIMENSAT 0 #endif