diff options
author | Danny Smith <dannysmith@users.sourceforge.net> | 2005-03-30 09:58:48 +0000 |
---|---|---|
committer | Danny Smith <dannysmith@gcc.gnu.org> | 2005-03-30 09:58:48 +0000 |
commit | 2d8a7f23ee9cbb193bbe2afb82288f2943df87d2 (patch) | |
tree | bce791a3c35ae1160381c46c5016b45ddd7e3328 /gcc | |
parent | 9ecbc8f49fcaf0a5864df7b07ead3369ccf9c07b (diff) | |
download | gcc-2d8a7f23ee9cbb193bbe2afb82288f2943df87d2.zip gcc-2d8a7f23ee9cbb193bbe2afb82288f2943df87d2.tar.gz gcc-2d8a7f23ee9cbb193bbe2afb82288f2943df87d2.tar.bz2 |
backport: tlink.c (recompile_files): Do not assume that "rename" can overwrite an existing file.
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.
From-SVN: r97252
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/tlink.c | 8 |
2 files changed, 15 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 915ec58..00025a8 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-31 Danny Smith <dannysmith@users.sourceforge.net> + + 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. + 2005-03-31 Paolo Bonzini <bonzini@gnu.org> * gcc/configure.ac (TL_AC_GNU_MAKE_GCC_LIB_PATH): Remove. 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) { |