svn commit: r316284 - head/contrib/elftoolchain/elfcopy

Ed Maste emaste at FreeBSD.org
Thu Mar 30 17:37:13 UTC 2017


Author: emaste
Date: Thu Mar 30 17:37:12 2017
New Revision: 316284
URL: https://svnweb.freebsd.org/changeset/base/316284

Log:
  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

Modified:
  head/contrib/elftoolchain/elfcopy/main.c

Modified: head/contrib/elftoolchain/elfcopy/main.c
==============================================================================
--- head/contrib/elftoolchain/elfcopy/main.c	Thu Mar 30 17:31:12 2017	(r316283)
+++ head/contrib/elftoolchain/elfcopy/main.c	Thu Mar 30 17:37:12 2017	(r316284)
@@ -674,6 +674,8 @@ create_file(struct elfcopy *ecp, const c
 		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);
 	}
 


More information about the svn-src-head mailing list