Commit e97fb4b0 authored by Alexandre Julliard's avatar Alexandre Julliard

Windows rename() needs an unlink() first (reported by Steven

Edwards).
parent 84512405
......@@ -183,8 +183,18 @@ int process_resources(const char* input_file_name, const char* specific_file_nam
if (inserting)
{
fclose(ftmp);
if (c == EOF && rename(tmp_file_name, input_file_name) < 0)
c = '.'; /* force an error */
if (c == EOF)
{
if (rename(tmp_file_name, input_file_name) < 0)
{
/* try unlinking first, Windows rename is brain-damaged */
if (unlink(input_file_name) < 0 || rename(tmp_file_name, input_file_name) < 0)
{
unlink(tmp_file_name);
return 0;
}
}
}
else unlink(tmp_file_name);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment