diff --git a/src/tup/entry.c b/src/tup/entry.c index 16d61fe8..90bc2c96 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); diff --git a/src/tup/platform.c b/src/tup/platform.c index 3ccc47cd..6e24f6d8 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";