зеркало из https://github.com/microsoft/git.git
Win32: mingw_unlink: support symlinks to directories
_wunlink() / DeleteFileW() refuses to delete symlinks to directories. If _wunlink() fails with ERROR_ACCESS_DENIED, try _wrmdir() as well. Signed-off-by: Karsten Blees <blees@dcon.de>
This commit is contained in:
Родитель
a8a8a71cf6
Коммит
528f0fce8b
|
@ -324,6 +324,13 @@ int mingw_unlink(const char *pathname)
|
||||||
return 0;
|
return 0;
|
||||||
if (!is_file_in_use_error(GetLastError()))
|
if (!is_file_in_use_error(GetLastError()))
|
||||||
break;
|
break;
|
||||||
|
/*
|
||||||
|
* _wunlink() / DeleteFileW() for directory symlinks fails with
|
||||||
|
* ERROR_ACCESS_DENIED (EACCES), so try _wrmdir() as well. This is the
|
||||||
|
* same error we get if a file is in use (already checked above).
|
||||||
|
*/
|
||||||
|
if (!_wrmdir(wpathname))
|
||||||
|
return 0;
|
||||||
} while (retry_ask_yes_no(&tries, "Unlink of file '%s' failed. "
|
} while (retry_ask_yes_no(&tries, "Unlink of file '%s' failed. "
|
||||||
"Should I try again?", pathname));
|
"Should I try again?", pathname));
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче