diff options
author | Mark Johnston <markj@FreeBSD.org> | 2019-08-07 03:14:45 +0000 |
---|---|---|
committer | Mark Johnston <markj@FreeBSD.org> | 2019-08-07 03:14:45 +0000 |
commit | 19669671510b1beb36c1e329357a551bb69ae15d (patch) | |
tree | 210210c464acb8f06b981f59332f7a99598ecd60 /contrib | |
parent | a15cb219c6f2b8ed16179c2fce882a2ff327b753 (diff) | |
download | src-19669671510b1beb36c1e329357a551bb69ae15d.tar.gz src-19669671510b1beb36c1e329357a551bb69ae15d.zip |
readelf: Close input files when done with them.
The low fd limit used by poudriere exposed an odd failure mode in
cap_fileargs (used by readelf as of r350516). In particular, when
the limit was hit, both the main process and casper service would
block on their shared socket, waiting forever for the other to send a
message.
Reported by: zeising
MFC after: 3 days
Sponsored by: The FreeBSD Foundation
Notes
Notes:
svn path=/head/; revision=350671
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/elftoolchain/readelf/readelf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/elftoolchain/readelf/readelf.c b/contrib/elftoolchain/readelf/readelf.c index b03798eabebd..de67c29516fd 100644 --- a/contrib/elftoolchain/readelf/readelf.c +++ b/contrib/elftoolchain/readelf/readelf.c @@ -7732,10 +7732,12 @@ main(int argc, char **argv) for (i = 0; i < argc; i++) { re->filename = argv[i]; fd = fileargs_open(fa, re->filename); - if (fd < 0) + if (fd < 0) { warn("open %s failed", re->filename); - else + } else { dump_object(re, fd); + close(fd); + } } exit(EXIT_SUCCESS); |