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

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

(cherry picked from commit 5581a1ec59bde33d52713f232620777b3c62628d)
parent 40a90cfe
......@@ -520,7 +520,17 @@ int vlc_rename (const char *oldpath, const char *newpath)
else
return -1;
#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
......
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