--- include/unistd.h 2023-10-05 03:55:05.000000000 +0800 +++ include/unistd.h 2026-01-16 04:01:53.000000000 +0800 @@ -47,4 +47,11 @@ #define HOST_NAME_MAX _POSIX_HOST_NAME_MAX #endif +#ifdef __APPLE__ +#include +#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200 +#define MAC_OS_MKOSTEMP_FALLBACK 1 +#endif +#endif + #endif --- src/repo.c 2026-01-14 02:38:47.000000000 +0800 +++ src/repo.c 2026-01-16 04:20:49.000000000 +0800 @@ -792,8 +792,15 @@ file = rrdp_state_filename(rr, 0); temp = rrdp_state_filename(rr, 1); - - if ((fd = mkostemp(temp, O_CLOEXEC)) == -1) +#if MAC_OS_MKOSTEMP_FALLBACK + fd = mkstemp(temp); + if (fd != -1) { + fcntl(fd, F_SETFD, FD_CLOEXEC); + } +#else + fd = mkostemp(temp, O_CLOEXEC) +#endif + if (fd == -1) goto fail; (void)fchmod(fd, 0644); f = fdopen(fd, "w"); --- src/output.c 2026-01-14 02:38:47.000000000 +0800 +++ src/output.c 2026-01-16 04:18:47.000000000 +0800 @@ -176,9 +176,18 @@ "%s.XXXXXXXXXXX", output_name); if (r < 0 || r > (int)sizeof(output_tmpname)) err(1, "path too long"); +#if MAC_OS_MKOSTEMP_FALLBACK + fd = mkstemp(output_tmpname); + if (fd != -1) { + fcntl(fd, F_SETFD, FD_CLOEXEC); + } else { + err(1, "mkstemp: %s", output_tmpname); + } +#else fd = mkostemp(output_tmpname, O_CLOEXEC); if (fd == -1) err(1, "mkostemp: %s", output_tmpname); +#endif (void) fchmod(fd, 0644); f = fdopen(fd, "w"); if (f == NULL)