diff --git a/compat/mingw.c b/compat/mingw.c index 18f2284c95..096804a2ec 100644 --- a/compat/mingw.c +++ b/compat/mingw.c @@ -2607,6 +2607,13 @@ repeat: gle = GetLastError(); } + if (gle == ERROR_ACCESS_DENIED && is_inside_windows_container()) { + /* Fall back to copy to destination & remove source */ + if (CopyFileW(wpold, wpnew, FALSE) && !mingw_unlink(pold, 1)) + return 0; + gle = GetLastError(); + } + /* revert file attributes on failure */ if (attrs != INVALID_FILE_ATTRIBUTES) SetFileAttributesW(wpnew, attrs);