aboutsummaryrefslogtreecommitdiff
path: root/gcc/tlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tlink.c')
-rw-r--r--gcc/tlink.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/tlink.c b/gcc/tlink.c
index bf4e1d7..3fe531a 100644
--- a/gcc/tlink.c
+++ b/gcc/tlink.c
@@ -470,7 +470,13 @@ recompile_files (void)
}
fclose (stream);
fclose (output);
- rename (outname, f->key);
+ /* On Windows "rename" returns -1 and sets ERRNO to EACCESS if
+ the new file name already exists. Therefore, we explicitly
+ remove the old file first. */
+ if (remove (f->key) == -1)
+ fatal_perror ("removing .rpo file");
+ if (rename (outname, f->key) == -1)
+ fatal_perror ("renaming .rpo file");
if (!f->args)
{