diff options
-rw-r--r-- | src/internal/slibtool_lconf_impl.c | 10 |
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; } |