summaryrefslogtreecommitdiffhomepage
path: root/src/internal
diff options
context:
space:
mode:
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/slibtool_readlink_impl.h5
-rw-r--r--src/internal/slibtool_symlink_impl.c4
-rw-r--r--src/internal/slibtool_symlink_impl.h2
3 files changed, 6 insertions, 5 deletions
diff --git a/src/internal/slibtool_readlink_impl.h b/src/internal/slibtool_readlink_impl.h
index 644a638..3730b1e 100644
--- a/src/internal/slibtool_readlink_impl.h
+++ b/src/internal/slibtool_readlink_impl.h
@@ -10,14 +10,15 @@
#include <unistd.h>
#include <errno.h>
-static inline int slbt_readlink(
+static inline int slbt_readlinkat(
+ int fdcwd,
const char * restrict path,
char * restrict buf,
ssize_t bufsize)
{
ssize_t ret;
- if ((ret = readlink(path,buf,bufsize)) <= 0) {
+ if ((ret = readlinkat(fdcwd,path,buf,bufsize)) <= 0) {
return -1;
} else if (ret == bufsize) {
errno = ENOBUFS;
diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c
index dd91d5e..cc09a32 100644
--- a/src/internal/slibtool_symlink_impl.c
+++ b/src/internal/slibtool_symlink_impl.c
@@ -108,7 +108,7 @@ int slbt_create_symlink(
: 0;
}
-int slbt_symlink_is_a_placeholder(char * lnkpath)
+int slbt_symlink_is_a_placeholder(int fdcwd, char * lnkpath)
{
size_t len;
char slink [PATH_MAX];
@@ -121,6 +121,6 @@ int slbt_symlink_is_a_placeholder(char * lnkpath)
memcpy(slink,lnkpath,len);
memcpy(&slink[len],suffix,sizeof(suffix));
- return (!slbt_readlink(slink,target,sizeof(target)))
+ return (!slbt_readlinkat(fdcwd,slink,target,sizeof(target)))
&& (!strcmp(target,"/dev/null"));
}
diff --git a/src/internal/slibtool_symlink_impl.h b/src/internal/slibtool_symlink_impl.h
index 9393a17..402208c 100644
--- a/src/internal/slibtool_symlink_impl.h
+++ b/src/internal/slibtool_symlink_impl.h
@@ -11,6 +11,6 @@ int slbt_create_symlink(
const char * lnkname,
bool flawrapper);
-int slbt_symlink_is_a_placeholder(char * lnkpath);
+int slbt_symlink_is_a_placeholder(int fdcwd, char * lnkpath);
#endif