From 1077d3c3f960c4e5a157c51815b8009f5114ab1a Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Thu, 25 Jun 2020 10:41:49 +0100 Subject: [PATCH] Build: guards on openat() --- src/OS/os.h-Linux | 2 +- src/src/functions.h | 2 ++ src/src/transports/queuefile.c | 4 ++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OS/os.h-Linux b/src/OS/os.h-Linux index c705e5cd2..ba5f13450 100644 --- a/src/OS/os.h-Linux +++ b/src/OS/os.h-Linux @@ -71,7 +71,7 @@ then change the 0 to 1 in the next block. */ # define LLONG_MAX LONG_LONG_MAX #endif -#if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOUCE +#if _POSIX_C_SOURCE >= 200809L || _ATFILE_SOURCE # define EXIM_HAVE_OPENAT #endif diff --git a/src/src/functions.h b/src/src/functions.h index 110d4db19..54de974c6 100644 --- a/src/src/functions.h +++ b/src/src/functions.h @@ -1104,6 +1104,7 @@ log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname); errno = EACCES; return -1; } +#ifdef EXIM_HAVE_OPENAT static inline int exim_openat(int dirfd, const char *pathname, int flags) { @@ -1120,6 +1121,7 @@ log_write(0, LOG_MAIN|LOG_PANIC, "Tainted filename '%s'", pathname); errno = EACCES; return -1; } +#endif static inline FILE * exim_fopen(const char *pathname, const char *mode) diff --git a/src/src/transports/queuefile.c b/src/src/transports/queuefile.c index 21ed3527f..259bfd941 100644 --- a/src/src/transports/queuefile.c +++ b/src/src/transports/queuefile.c @@ -11,6 +11,10 @@ #include "../exim.h" #include "queuefile.h" +#ifndef EXIM_HAVE_OPENAT +# error queuefile transport reqires openat() support +#endif + /* Options specific to the appendfile transport. They must be in alphabetic order (note that "_" comes before the lower case letters). Some of them are stored in the publicly visible instance block - these are flagged with the -- 2.30.2