summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-02-20 02:42:27 +0000
committermidipix <writeonce@midipix.org>2024-02-20 02:42:27 +0000
commit7cfae736248dfe29a779f702841defcb6986bb69 (patch)
tree0c03c4dad4766b7083ad0a83c6b90e154b054cf6
parentd1890b0eb71b6ecbea7df8ee3774465418d5b13b (diff)
downloadslibtool-7cfae736248dfe29a779f702841defcb6986bb69.tar.bz2
slibtool-7cfae736248dfe29a779f702841defcb6986bb69.tar.xz
slbt_ar_create_mapfile(): close file descriptor of a newly created output file.
-rw-r--r--src/arbits/slbt_archive_mapfile.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/arbits/slbt_archive_mapfile.c b/src/arbits/slbt_archive_mapfile.c
index 2bca16d..976b809 100644
--- a/src/arbits/slbt_archive_mapfile.c
+++ b/src/arbits/slbt_archive_mapfile.c
@@ -67,6 +67,7 @@ static int slbt_ar_create_mapfile_impl(
const char * path,
mode_t mode)
{
+ int ret;
struct slbt_archive_meta_impl * mctx;
const struct slbt_driver_ctx * dctx;
struct slbt_fd_ctx fdctx;
@@ -91,8 +92,14 @@ static int slbt_ar_create_mapfile_impl(
fdout = fdctx.fdout;
}
- return slbt_ar_output_mapfile_impl(
+ ret = slbt_ar_output_mapfile_impl(
dctx,mctx,fdout);
+
+ if (path) {
+ close(fdout);
+ }
+
+ return ret;
}