file mode problem if the outfile already exists
Unified · Split
| @@ -2086,6 +2086,7 @@ static int elf_output_file(TCCState *s1, const char *filename) · 2085 unmodified lines | |||
| 2086 | mode = 0666; | 2086 | mode = 0666; |
| 2087 | else | 2087 | else |
| 2088 | mode = 0777; | 2088 | mode = 0777; |
| 2089 | unlink(filename); | ||
| 2089 | fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode); | 2090 | fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode); |
| 2090 | if (fd < 0) { | 2091 | if (fd < 0) { |
| 2091 | error_noabort("could not write '%s'", filename); | 2092 | error_noabort("could not write '%s'", filename); |