Author: tfaber
Date: Thu Aug 11 11:41:25 2016
New Revision: 72195
URL:
http://svn.reactos.org/svn/reactos?rev=72195&view=rev
Log:
[FASTFAT]
- Cancel deletion of a directory if it is not empty when its last handle is closed
CORE-6931
Modified:
trunk/reactos/drivers/filesystems/fastfat/cleanup.c
Modified: trunk/reactos/drivers/filesystems/fastfat/cleanup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/filesystems/fastfa…
==============================================================================
--- trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/filesystems/fastfat/cleanup.c [iso-8859-1] Thu Aug 11 11:41:25
2016
@@ -66,7 +66,7 @@
pFcb->OpenHandleCount--;
DeviceExt->OpenHandleCount--;
- if (!(*pFcb->Attributes & FILE_ATTRIBUTE_DIRECTORY) &&
+ if (!vfatFCBIsDirectory(pFcb) &&
FsRtlAreThereCurrentFileLocks(&pFcb->FileLock))
{
/* remove all locks this process have on this file */
@@ -84,18 +84,26 @@
if (pFcb->Flags & FCB_DELETE_PENDING &&
pFcb->OpenHandleCount == 0)
{
- PFILE_OBJECT tmpFileObject;
- tmpFileObject = pFcb->FileObject;
- if (tmpFileObject != NULL)
+ if (vfatFCBIsDirectory(pFcb) &&
+ !VfatIsDirectoryEmpty(pFcb))
{
- pFcb->FileObject = NULL;
- CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
- ObDereferenceObject(tmpFileObject);
+ pFcb->Flags &= ~FCB_DELETE_PENDING;
}
+ else
+ {
+ PFILE_OBJECT tmpFileObject;
+ tmpFileObject = pFcb->FileObject;
+ if (tmpFileObject != NULL)
+ {
+ pFcb->FileObject = NULL;
+ CcUninitializeCacheMap(tmpFileObject, NULL, NULL);
+ ObDereferenceObject(tmpFileObject);
+ }
- pFcb->RFCB.ValidDataLength.QuadPart = 0;
- pFcb->RFCB.FileSize.QuadPart = 0;
- pFcb->RFCB.AllocationSize.QuadPart = 0;
+ pFcb->RFCB.ValidDataLength.QuadPart = 0;
+ pFcb->RFCB.FileSize.QuadPart = 0;
+ pFcb->RFCB.AllocationSize.QuadPart = 0;
+ }
}
/* Uninitialize the cache (should be done even if caching was never initialized)
*/