mirror of
https://github.com/reactos/reactos.git
synced 2025-04-25 16:10:29 +00:00
VfatSetAllocationSizeInformation: The fast code for extending the size of a non-empty file did have a bug in that it didn't always set Fcb->LastCluster/Fcb->LastOffset but the OffsetToCluster call was made assuming that it did. However, the code that replaced it had a bug as well, in that it did not set Cluster to the original final cluster like the error handling code expected, so it would crash when out of disk space. Bringing back the fast code, but with its bug fixed.
svn path=/trunk/; revision=38179
This commit is contained in:
parent
9b0331478f
commit
220378c764
1 changed files with 2 additions and 12 deletions
|
@ -639,7 +639,6 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject,
|
|||
}
|
||||
else
|
||||
{
|
||||
#if 0 /* FIXME */
|
||||
if (Fcb->LastCluster > 0)
|
||||
{
|
||||
if (Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize == Fcb->LastOffset)
|
||||
|
@ -665,23 +664,14 @@ VfatSetAllocationSizeInformation(PFILE_OBJECT FileObject,
|
|||
return Status;
|
||||
}
|
||||
|
||||
if (Fcb->LastCluster == 0)
|
||||
{
|
||||
Fcb->LastCluster = Cluster;
|
||||
Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize;
|
||||
}
|
||||
Fcb->LastCluster = Cluster;
|
||||
Fcb->LastOffset = Fcb->RFCB.AllocationSize.u.LowPart - ClusterSize;
|
||||
|
||||
/* FIXME: Check status */
|
||||
/* Cluster points now to the last cluster within the chain */
|
||||
Status = OffsetToCluster(DeviceExt, Cluster,
|
||||
ROUND_DOWN(NewSize - 1, ClusterSize) - Fcb->LastOffset,
|
||||
&NCluster, TRUE);
|
||||
#else
|
||||
Status = OffsetToCluster(DeviceExt, FirstCluster,
|
||||
ROUND_DOWN(NewSize - 1, ClusterSize),
|
||||
&Cluster, TRUE);
|
||||
NCluster = Cluster;
|
||||
#endif
|
||||
if (NCluster == 0xffffffff || !NT_SUCCESS(Status))
|
||||
{
|
||||
/* disk is full */
|
||||
|
|
Loading…
Reference in a new issue