aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2016-06-19 23:19:40 -0400
committerMike Frysinger <vapier@gentoo.org>2016-06-19 23:19:40 -0400
commita17419af271edc0edabe79cb6c9616fafcf15bfd (patch)
treef4413f3bf5060d2fd31c33eb683bb0c80a57bbe8
parentscanelf: use strcpy to make coverity happy (diff)
downloadpax-utils-a17419af271edc0edabe79cb6c9616fafcf15bfd.tar.gz
pax-utils-a17419af271edc0edabe79cb6c9616fafcf15bfd.tar.bz2
pax-utils-a17419af271edc0edabe79cb6c9616fafcf15bfd.zip
scanelf: avoid leaking root_fd when multiple --root args are passed
-rw-r--r--scanelf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/scanelf.c b/scanelf.c
index 42fe4c5..3f33d89 100644
--- a/scanelf.c
+++ b/scanelf.c
@@ -2350,6 +2350,8 @@ static int parseargs(int argc, char *argv[])
case 'I': show_osabi = 1; break;
case 'Y': show_eabi = 1; break;
case 128:
+ if (root_fd != AT_FDCWD)
+ close(root_fd);
root_fd = open(optarg, O_RDONLY|O_CLOEXEC);
if (root_fd == -1)
err("Could not open root: %s", optarg);