From 6d95ab9249d12ac8d1b9e0a0dbaaf28a8b4f8ddc Mon Sep 17 00:00:00 2001 From: jmcmullan Date: Tue, 6 Nov 2012 01:29:45 +0000 Subject: [PATCH] elf2hunk: Remove old files before creating new ones Signed-off-by: Jason S. McMullan git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@46007 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- tools/elf2hunk/elf2hunk.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/elf2hunk/elf2hunk.c b/tools/elf2hunk/elf2hunk.c index bffd79d8cd..60727fabd3 100644 --- a/tools/elf2hunk/elf2hunk.c +++ b/tools/elf2hunk/elf2hunk.c @@ -1040,8 +1040,10 @@ static int copy(const char *src, const char *dst, int flags) if (strcmp(dst,"-") == 0) hunk_fd = 1; /* stdout */ - else + else { + unlink(dst); hunk_fd = open(dst, O_RDWR | O_CREAT | O_TRUNC, mode); + } if (hunk_fd < 0) { perror(dst); return EXIT_FAILURE; -- 2.11.4.GIT