summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/driver/tpax_unit_ctx.c3
-rw-r--r--src/internal/tpax_readlink_impl.h5
2 files changed, 5 insertions, 3 deletions
diff --git a/src/driver/tpax_unit_ctx.c b/src/driver/tpax_unit_ctx.c
index a94bf05..0f0bd98 100644
--- a/src/driver/tpax_unit_ctx.c
+++ b/src/driver/tpax_unit_ctx.c
@@ -55,7 +55,8 @@ int tpax_get_unit_ctx(
}
if (S_ISLNK(ctx->st.st_mode)) {
- if (tpax_readlink(
+ if (tpax_readlinkat(
+ tpax_driver_fdcwd(dctx),
path,ctx->linkbuf,
sizeof(ctx->linkbuf)) < 0) {
free(ctx);
diff --git a/src/internal/tpax_readlink_impl.h b/src/internal/tpax_readlink_impl.h
index 328b302..7fdffc4 100644
--- a/src/internal/tpax_readlink_impl.h
+++ b/src/internal/tpax_readlink_impl.h
@@ -10,14 +10,15 @@
#include <unistd.h>
#include <errno.h>
-static inline int tpax_readlink(
+static inline int tpax_readlinkat(
+ int fdat,
const char * restrict path,
char * restrict buf,
ssize_t bufsize)
{
ssize_t ret;
- if ((ret = readlink(path,buf,bufsize)) <= 0) {
+ if ((ret = readlinkat(fdat,path,buf,bufsize)) <= 0) {
return -1;
} else if (ret == bufsize) {
errno = ENOBUFS;