summaryrefslogtreecommitdiffstats
path: root/src/ar.c
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2021-04-03 19:20:32 +0200
committerMark Wielaard <[email protected]>2021-04-13 14:45:34 +0200
commitb58516a620c70db026b13f6c36b634d3ae7f1739 (patch)
tree8df9df9baf395189aa2816600788a7bac449e973 /src/ar.c
parenta8e925ec759712f969166d941b82817e9b68cfb9 (diff)
ar: Always close newfd in do_oper_insert.
newfd is normally created by mkstemp given the original fd exists. Otherwise it will created by open from arfname. In the second case newfd might not get closed. Preventd this by always trying to close it after errout. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'src/ar.c')
-rw-r--r--src/ar.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/ar.c b/src/ar.c
index 66b2c4fd..ab6098f0 100644
--- a/src/ar.c
+++ b/src/ar.c
@@ -1566,6 +1566,9 @@ do_oper_insert (int oper, const char *arfname, char **argv, int argc,
if (fd != -1)
close (fd);
+ if (newfd != -1)
+ close (newfd);
+
return status;
}