Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2017 17:37:12 +0000 (UTC)
From:      Ed Maste <emaste@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r316284 - head/contrib/elftoolchain/elfcopy
Message-ID:  <201703301737.v2UHbCkX085444@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 	}
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201703301737.v2UHbCkX085444>