[FASTFAT] When overwriting a file with FILE_OVERWRITE*, don't erase previous file...
authorPierre Schweitzer <pierre@reactos.org>
Mon, 1 Jan 2018 13:29:15 +0000 (14:29 +0100)
committerPierre Schweitzer <pierre@reactos.org>
Mon, 1 Jan 2018 13:29:15 +0000 (14:29 +0100)
Keep erasing them in case the file gets overwritten with FILE_SUPERSEDE.

CORE-14158

drivers/filesystems/fastfat/create.c

index 89ac5e0..49c5420 100644 (file)
@@ -919,7 +919,14 @@ VfatCreateFile(
 
             if (!vfatFCBIsDirectory(pFcb))
             {
-                *pFcb->Attributes = Attributes & ~FILE_ATTRIBUTE_NORMAL;
+                if (RequestedDisposition == FILE_SUPERSEDE)
+                {
+                    *pFcb->Attributes = Attributes & ~FILE_ATTRIBUTE_NORMAL;
+                }
+                else
+                {
+                    *pFcb->Attributes |= Attributes & ~FILE_ATTRIBUTE_NORMAL;
+                }
                 *pFcb->Attributes |= FILE_ATTRIBUTE_ARCHIVE;
                 VfatUpdateEntry(pFcb, vfatVolumeIsFatX(DeviceExt));
             }