From 7572bf164180e66db5e8a5c221a406c287117925 Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 23 May 2025 02:46:52 +0800 Subject: [PATCH 1/2] entry.c: fallback for missing F_DUPFD_CLOEXEC --- src/tup/entry.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/tup/entry.c b/src/tup/entry.c index 16d61fe8c..90bc2c968 100644 --- a/src/tup/entry.c +++ b/src/tup/entry.c @@ -359,7 +359,19 @@ static int entry_openat_internal(int root_dfd, struct tup_entry *tent) if(!tent) return -1; if(tent->parent == NULL) { - return fcntl(root_dfd, F_DUPFD_CLOEXEC, 0); +#ifdef F_DUPFD_CLOEXEC + int fd = fcntl(root_dfd, F_DUPFD_CLOEXEC, 0); + if(fd != -1 || errno != EINVAL) + return fd; +#endif + int fd = fcntl(root_dfd, F_DUPFD, 0); + if(fd == -1) + return -1; + if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { + close(fd); + return -1; + } + return fd; } dfd = entry_openat_internal(root_dfd, tent->parent); From b59d0c84ec028944fe9a0dc79d500dc2ce49422a Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Fri, 23 May 2025 02:52:20 +0800 Subject: [PATCH 2/2] platform.c: fix powerpc macros --- src/tup/platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tup/platform.c b/src/tup/platform.c index 3ccc47cd5..6e24f6d81 100644 --- a/src/tup/platform.c +++ b/src/tup/platform.c @@ -44,9 +44,9 @@ const char *tup_platform = "netbsd"; const char *tup_arch = "x86_64"; #elif __i386__ const char *tup_arch = "i386"; -#elif __powerpc__ +#elif __powerpc__ || __ppc__ const char *tup_arch = "powerpc"; -#elif __powerpc64__ +#elif __powerpc64__ || __ppc64__ const char *tup_arch = "powerpc64"; #elif __ia64__ const char *tup_arch = "ia64";