summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-14 07:15:56 (GMT)
committermidipix <writeonce@midipix.org>2018-08-14 07:15:56 (GMT)
commitbab3d0330c7953d8b878a99e956b6955d893f48e (patch)
treef607d0c2cb21f6bcea471c8167c3f083b94d5859
parentcb91195c9bb14d3381aac4d74bff5c695a5cb6b4 (diff)
downloadslibtool-bab3d0330c.tar.bz2
slibtool-bab3d0330c.tar.xz
slbt_lconf_open(): close all temporarily-opened directory file descriptors.
-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;
}