From c27e76aa2aa6dce1c5a0409ba97e2c7ef313aa33 Mon Sep 17 00:00:00 2001 From: Changming Xu Date: Thu, 3 Mar 2011 21:09:18 +0800 Subject: [PATCH] unlink outfile first file mode problem if the outfile already exists --- tccelf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tccelf.c b/tccelf.c index 8865d8a..a479a98 100644 --- a/tccelf.c +++ b/tccelf.c @@ -2086,6 +2086,7 @@ static int elf_output_file(TCCState *s1, const char *filename) mode = 0666; else mode = 0777; + unlink(filename); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode); if (fd < 0) { error_noabort("could not write '%s'", filename);