mirror of
git://repo.or.cz/tinycc.git
synced 2026-11-06 13:57:45 +08:00
unlink outfile first
file mode problem if the outfile already exists
This commit is contained in:
parent
c93eca4fe4
commit
c27e76aa2a
1
tccelf.c
1
tccelf.c
@ -2086,6 +2086,7 @@ static int elf_output_file(TCCState *s1, const char *filename)
|
|||||||
mode = 0666;
|
mode = 0666;
|
||||||
else
|
else
|
||||||
mode = 0777;
|
mode = 0777;
|
||||||
|
unlink(filename);
|
||||||
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode);
|
fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
error_noabort("could not write '%s'", filename);
|
error_noabort("could not write '%s'", filename);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user