1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-10 14:02:43 +00:00

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
This commit is contained in:
Ed Maste 2017-03-30 17:37:12 +00:00
parent c13fa60c22
commit 9bfb310cf3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=316284

View File

@ -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);
}