From: Peter Pentchev Date: Sun, 20 Mar 2022 16:25:50 +0000 (+0000) Subject: Fix the build on kFreeBSD - no UTIME_NOW. X-Git-Tag: archive/raspbian/1.4.9+dfsg-1+rpi1^2~1 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=09efdfff7b7bf174c97af5aed46901b28c8c33d7;p=libzstd.git Fix the build on kFreeBSD - no UTIME_NOW. Forwarded: no Last-Update: 2022-03-20 Gbp-Pq: Name 0018-kfreebsd-ftbfs-utime-now.patch --- diff --git a/programs/util.c b/programs/util.c index a1bd323..36664f8 100644 --- a/programs/util.c +++ b/programs/util.c @@ -28,7 +28,8 @@ extern "C" { # include /* _chmod */ #else # include /* chown, stat */ -# if PLATFORM_POSIX_VERSION < 200809L || !defined(st_mtime) +# if PLATFORM_POSIX_VERSION < 200809L || !defined(st_mtime) || defined(__FreeBSD_kernel__) +# include # include /* utime */ # else # include /* AT_FDCWD */ @@ -182,8 +183,9 @@ int UTIL_setFileStat(const char *filename, const stat_t *statbuf) * check because there are some platforms that claim to be POSIX 2008 * compliant but which do not have st_mtim... * And then there is alpha, which doesn't define st_mtime, but still has it. + * Also, kFreeBSD does not seem to define UTIME_NOW. */ -#if (PLATFORM_POSIX_VERSION >= 200809L) && (defined(st_mtime) || defined(__alpha__)) +#if (PLATFORM_POSIX_VERSION >= 200809L) && (defined(st_mtime) || defined(__alpha__)) && (!defined(__FreeBSD_kernel__)) { /* (atime, mtime) */ struct timespec timebuf[2] = { {0, UTIME_NOW} };