From 2ff2859c237a0b4928c28a0086dd2f5fb9b2da70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Fri, 20 Nov 2020 17:50:34 +0100 Subject: Add compat mode for systems without openat(2) --- Compat.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Compat.c') diff --git a/Compat.c b/Compat.c index 37e7c042..dfe2151f 100644 --- a/Compat.c +++ b/Compat.c @@ -80,6 +80,20 @@ int Compat_fstatat(int dirfd, #endif } +#ifndef HAVE_OPENAT + +int Compat_openat(const char* dirpath, + const char* pathname, + int flags) { + + char path[4096]; + xSnprintf(path, sizeof(path), "%s/%s", dirpath, pathname); + + return open(path, flags); +} + +#endif /* !HAVE_OPENAT */ + int Compat_readlinkat(int dirfd, const char* dirpath, const char* pathname, -- cgit v1.2.3