From: dannysmith Date: Wed, 30 Mar 2005 09:58:48 +0000 (+0000) Subject: Merge from csl-arm-branch. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e39224c2bae86dea7402c483c4838668481f4aed;p=thirdparty%2Fgcc.git Merge from csl-arm-branch. 2004-02-12 Mark Mitchell * 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 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 915ec58c6939..00025a8002b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2005-03-31 Danny Smith + + Merge from csl-arm-branch. + 2004-02-12 Mark Mitchell + + * tlink.c (recompile_files): Do not assume that "rename" can + overwrite an existing file. + 2005-03-31 Paolo Bonzini * gcc/configure.ac (TL_AC_GNU_MAKE_GCC_LIB_PATH): Remove. diff --git a/gcc/tlink.c b/gcc/tlink.c index bf4e1d757b0f..3fe531af9e79 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) {