makedep: Handle non-overwriting rename for Windows.

This commit is contained in:
Dylan Smith 2009-08-22 01:57:47 -04:00 committed by Alexandre Julliard
parent 7823679e20
commit 8e0b17462b
1 changed files with 8 additions and 1 deletions

View File

@ -960,7 +960,14 @@ static void output_dependencies(void)
if (tmp_name) if (tmp_name)
{ {
if (rename( tmp_name, OutputFileName ) == -1) int ret = rename( tmp_name, OutputFileName );
if (ret == -1 && errno == EEXIST)
{
/* rename doesn't overwrite on windows */
unlink( OutputFileName );
ret = rename( tmp_name, OutputFileName );
}
if (ret == -1)
{ {
unlink( tmp_name ); unlink( tmp_name );
fatal_error( "failed to rename output file to '%s'\n", OutputFileName ); fatal_error( "failed to rename output file to '%s'\n", OutputFileName );