diff options
author | Ed Maste <emaste@FreeBSD.org> | 2017-03-30 17:37:12 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2017-03-30 17:37:12 +0000 |
commit | 9bfb310cf39c686dfa54b4910ee9ccabd200bae4 (patch) | |
tree | 8f79eaa00b5ba445c4218a4432bd8a66976dc92d /contrib/elftoolchain | |
parent | c13fa60c22beb4bbcd9cb44dd9e78d3173fc564e (diff) | |
download | src-9bfb310cf39c686dfa54b4910ee9ccabd200bae4.tar.gz src-9bfb310cf39c686dfa54b4910ee9ccabd200bae4.zip |
elfcopy: remove temporary ELF file when converting from binary
Previously a command like
objcopy --input-target binary --output-target elf64-x86-64-freebsd \
binary_file object.o
would leave a temporary file behind.
ELF Tool Chain ticket #543
Reported by: Roger Marquis
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Notes
Notes:
svn path=/head/; revision=316284
Diffstat (limited to 'contrib/elftoolchain')
-rw-r--r-- | contrib/elftoolchain/elfcopy/main.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/contrib/elftoolchain/elfcopy/main.c b/contrib/elftoolchain/elfcopy/main.c index 1917c646c887..f1f487d8efe4 100644 --- a/contrib/elftoolchain/elfcopy/main.c +++ b/contrib/elftoolchain/elfcopy/main.c @@ -674,6 +674,8 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst) if ((ifd = open(elftemp, O_RDONLY)) == -1) err(EXIT_FAILURE, "open %s failed", src); close(efd); + if (unlink(elftemp) < 0) + err(EXIT_FAILURE, "unlink %s failed", elftemp); free(elftemp); } |