[exim-cvs] Build: guards on openat()

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] Build: guards on openat()
Gitweb: https://git.exim.org/exim.git/commitdiff/1077d3c3f960c4e5a157c51815b8009f5114ab1a
Commit:     1077d3c3f960c4e5a157c51815b8009f5114ab1a
Parent:     bec94709e708f087fe7fa456bec95d4e63edc3ed
Author:     Jeremy Harris <jgh146exb@???>
AuthorDate: Thu Jun 25 10:41:49 2020 +0100
Committer:  Jeremy Harris <jgh146exb@???>
CommitDate: Thu Jun 25 10:41:49 2020 +0100


    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 c705e5c..ba5f134 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 110d4db..54de974 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 21ed352..259bfd9 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