summaryrefslogtreecommitdiff
path: root/src/internal
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-09-13 02:54:00 +0000
committermidipix <writeonce@midipix.org>2020-09-13 02:54:00 +0000
commit0b404d0ff40eb6eb6315e8d58e809d6adc5f34c8 (patch)
tree1c0527e49ab7dc30e050f8db0eeb75196ca7d30e /src/internal
parentdee1f2ee445ae769ff1f2ff68e30e776c5e7da75 (diff)
downloadslibtool-0b404d0ff40eb6eb6315e8d58e809d6adc5f34c8.tar.bz2
slibtool-0b404d0ff40eb6eb6315e8d58e809d6adc5f34c8.tar.xz
slbt_lconf_open(): exit loop upon reaching the top-level root directory.
Diffstat (limited to 'src/internal')
-rw-r--r--src/internal/slibtool_lconf_impl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index 691536d..92aaa20 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -40,6 +40,7 @@ static int slbt_lconf_open(
int fdparent;
struct stat stcwd;
struct stat stparent;
+ ino_t stinode;
fdcwd = slbt_driver_fdcwd(dctx);
fdlconfdir = fdcwd;
@@ -53,6 +54,7 @@ static int slbt_lconf_open(
return SLBT_SYSTEM_ERROR(dctx);
fdlconf = openat(fdlconfdir,"libtool",O_RDONLY,0);
+ stinode = stcwd.st_ino;
while (fdlconf < 0) {
fdparent = openat(fdlconfdir,"../",O_DIRECTORY,0);
@@ -72,8 +74,15 @@ static int slbt_lconf_open(
dctx,SLBT_ERR_LCONF_OPEN);
}
+ if (stparent.st_ino == stinode) {
+ close(fdparent);
+ return SLBT_CUSTOM_ERROR(
+ dctx,SLBT_ERR_LCONF_OPEN);
+ }
+
fdlconfdir = fdparent;
fdlconf = openat(fdlconfdir,"libtool",O_RDONLY,0);
+ stinode = stparent.st_ino;
}
slbt_lconf_close(fdcwd,fdlconfdir);