summaryrefslogtreecommitdiffstats
path: root/gcc/tlink.c
diff options
context:
space:
mode:
authordannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-30 09:58:48 +0000
committerdannysmith <dannysmith@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-30 09:58:48 +0000
commite39224c2bae86dea7402c483c4838668481f4aed (patch)
treebce791a3c35ae1160381c46c5016b45ddd7e3328 /gcc/tlink.c
parentd0c5a09035460d72a74f96d59d77009afbb81b7d (diff)
downloadppe42-gcc-e39224c2bae86dea7402c483c4838668481f4aed.tar.gz
ppe42-gcc-e39224c2bae86dea7402c483c4838668481f4aed.zip
Merge from csl-arm-branch.
2004-02-12 Mark Mitchell <mark@codesourcery.com> * tlink.c (recompile_files): Do not assume that "rename" can overwrite an existing file. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@97252 138bc75d-0d04-0410-961f-82ee72b054a4
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 bf4e1d757b0..3fe531af9e7 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)
{
OpenPOWER on IntegriCloud