summaryrefslogtreecommitdiffstats
path: root/Compat.c
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2020-10-29 23:02:57 +0100
committerBenny Baumann <BenBE@geshi.org>2020-11-09 19:17:57 +0100
commit2d6da2e52066067e4c82a2e16f73438319e1db81 (patch)
tree5e3180abd332708ae94ec34b56d9e89dddb2a6e5 /Compat.c
parent84dad4c38ee4eb16ea8716891419b0a3780f3818 (diff)
Add compat wrapper for readlinkat
Diffstat (limited to 'Compat.c')
-rw-r--r--Compat.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/Compat.c b/Compat.c
index 25aa9f73..6401f696 100644
--- a/Compat.c
+++ b/Compat.c
@@ -13,9 +13,7 @@ in the source distribution for its full text.
#include <sys/stat.h>
#include "Compat.h"
-#ifndef HAVE_FSTATAT
#include "XUtils.h"
-#endif
int Compat_fstatat(int dirfd,
@@ -44,3 +42,27 @@ int Compat_fstatat(int dirfd,
#endif
}
+
+int Compat_readlinkat(int dirfd,
+ const char* dirpath,
+ const char* pathname,
+ char* buf,
+ size_t bufsize) {
+
+#ifdef HAVE_READLINKAT
+
+ (void)dirpath;
+
+ return readlinkat(dirfd, pathname, buf, bufsize);
+
+#else
+
+ (void)dirfd;
+
+ char path[4096];
+ xSnprintf(path, sizeof(path), "%s/%s", dirpath, pathname);
+
+ return readlink(path, buf, bufsize);
+
+#endif
+}

© 2014-2024 Faster IT GmbH | imprint | privacy policy