Fixed permission check when renaming a directory (based on a patch by
Andriy Palamarchuk).
This commit is contained in:
parent
85350c8c95
commit
96d05d1559
12
files/file.c
12
files/file.c
|
@ -2627,8 +2627,16 @@ BOOL WINAPI MoveFileExW( LPCWSTR fn1, LPCWSTR fn2, DWORD flag )
|
||||||
hFile = FILE_CreateFile( full_name1.long_name, 0, 0,
|
hFile = FILE_CreateFile( full_name1.long_name, 0, 0,
|
||||||
NULL, OPEN_EXISTING, 0, 0, TRUE,
|
NULL, OPEN_EXISTING, 0, 0, TRUE,
|
||||||
GetDriveTypeW( full_name1.short_name ) );
|
GetDriveTypeW( full_name1.short_name ) );
|
||||||
if (!hFile) return FALSE;
|
if (!hFile)
|
||||||
CloseHandle(hFile);
|
{
|
||||||
|
DWORD attr;
|
||||||
|
|
||||||
|
if (GetLastError() != ERROR_ACCESS_DENIED) return FALSE;
|
||||||
|
attr = GetFileAttributesA( full_name1.long_name );
|
||||||
|
if (attr == (DWORD)-1 || !(attr & FILE_ATTRIBUTE_DIRECTORY)) return FALSE;
|
||||||
|
/* if it's a directory we can continue */
|
||||||
|
}
|
||||||
|
else CloseHandle(hFile);
|
||||||
|
|
||||||
/* check, if we are allowed to delete the destination,
|
/* check, if we are allowed to delete the destination,
|
||||||
** (but the file not being there is fine) */
|
** (but the file not being there is fine) */
|
||||||
|
|
Loading…
Reference in New Issue