summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-14 03:15:56 -0400
committermidipix <writeonce@midipix.org>2018-08-14 03:15:56 -0400
commitbab3d0330c7953d8b878a99e956b6955d893f48e (patch)
treef607d0c2cb21f6bcea471c8167c3f083b94d5859 /src
parentcb91195c9bb14d3381aac4d74bff5c695a5cb6b4 (diff)
downloadslibtool-bab3d0330c7953d8b878a99e956b6955d893f48e.tar.bz2
slibtool-bab3d0330c7953d8b878a99e956b6955d893f48e.tar.xz
slbt_lconf_open(): close all temporarily-opened directory file descriptors.
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_lconf_impl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c
index c5f721a..691536d 100644
--- a/src/internal/slibtool_lconf_impl.c
+++ b/src/internal/slibtool_lconf_impl.c
@@ -61,17 +61,23 @@ static int slbt_lconf_open(
if (fdparent < 0)
return SLBT_SYSTEM_ERROR(dctx);
- if (fstat(fdparent,&stparent) < 0)
+ if (fstat(fdparent,&stparent) < 0) {
+ close(fdparent);
return SLBT_SYSTEM_ERROR(dctx);
+ }
- if (stparent.st_dev != stcwd.st_dev)
+ if (stparent.st_dev != stcwd.st_dev) {
+ close(fdparent);
return SLBT_CUSTOM_ERROR(
dctx,SLBT_ERR_LCONF_OPEN);
+ }
fdlconfdir = fdparent;
fdlconf = openat(fdlconfdir,"libtool",O_RDONLY,0);
}
+ slbt_lconf_close(fdcwd,fdlconfdir);
+
return fdlconf;
}