Commit 5581a1ec authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Win32: vlc_rename() needs to erase target file first, fixes #3521

parent 0d0e440d
...@@ -520,7 +520,17 @@ int vlc_rename (const char *oldpath, const char *newpath) ...@@ -520,7 +520,17 @@ int vlc_rename (const char *oldpath, const char *newpath)
else else
return -1; return -1;
#else #else
return _wrename (wold, wnew); if (_wrename (wold, wnew) && errno == EACCES)
{ /* Windows does not allow atomic file replacement */
if (_wremove (wnew))
{
errno = EACCES; /* restore errno */
return -1;
}
if (_wrename (wold, wnew))
return -1;
}
return 0;
#endif #endif
#endif #endif
......
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