unlink outfile first
file mode problem if the outfile already exists
This commit is contained in:
parent
c93eca4fe4
commit
c27e76aa2a
1 changed files with 1 additions and 0 deletions
1
tccelf.c
1
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);
|
||||
|
|
Loading…
Reference in a new issue