From: Thomas Faber Date: Thu, 6 Nov 2014 00:07:01 +0000 (+0000) Subject: [FASTFAT] X-Git-Tag: backups/tcpip_revolution@71025~75 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=453e37073796e9db1a681d19b30e771748e90eb4 [FASTFAT] - Fix failure case handling in vfatUpdateFCB - NULL output parameters on failure in vfatGetFCBForFile - Fix a few typos svn path=/trunk/; revision=65278 --- diff --git a/reactos/drivers/filesystems/fastfat/create.c b/reactos/drivers/filesystems/fastfat/create.c index c55d9ee5aad..ede9a75f8d9 100644 --- a/reactos/drivers/filesystems/fastfat/create.c +++ b/reactos/drivers/filesystems/fastfat/create.c @@ -583,7 +583,7 @@ VfatCreateFile( idx = FileObject->FileName.Length / sizeof(WCHAR) - 1; - /* Skip tailing \ - if any */ + /* Skip trailing \ - if any */ if (PathNameU.Buffer[idx] == L'\\') { --idx; diff --git a/reactos/drivers/filesystems/fastfat/fcb.c b/reactos/drivers/filesystems/fastfat/fcb.c index f2a04e7b47b..df4dd54e083 100644 --- a/reactos/drivers/filesystems/fastfat/fcb.c +++ b/reactos/drivers/filesystems/fastfat/fcb.c @@ -371,6 +371,13 @@ vfatUpdateFCB( DPRINT("vfatUpdateFCB(%p, %p, %wZ, %wZ, %p)\n", pVCB, Fcb, LongName, ShortName, ParentFcb); + /* Get full path name */ + Status = vfatMakeFullName(ParentFcb, LongName, ShortName, &Fcb->PathNameU); + if (!NT_SUCCESS(Status)) + { + return Status; + } + /* Delete old name */ if (Fcb->PathNameBuffer) { @@ -380,13 +387,6 @@ vfatUpdateFCB( /* Delete from table */ vfatDelFCBFromTable(pVCB, Fcb); - /* Get full path name */ - Status = vfatMakeFullName(ParentFcb, LongName, ShortName, &Fcb->PathNameU); - if (!NT_SUCCESS(Status)) - { - return Status; - } - /* Split it properly */ Fcb->PathNameBuffer = Fcb->PathNameU.Buffer; Fcb->DirNameU.Buffer = Fcb->PathNameU.Buffer; @@ -414,8 +414,8 @@ vfatUpdateFCB( /* Add to the table */ vfatAddFCBToTable(pVCB, Fcb); - /* If we moved accross directories, dereferenced our old parent - * We also derefence in case we're just renaming since AddFCBToTable references it + /* If we moved across directories, dereference our old parent + * We also dereference in case we're just renaming since AddFCBToTable references it */ vfatReleaseFCB(pVCB, OldParent); @@ -887,7 +887,7 @@ vfatGetFCBForFile( if (parentFCB) { vfatReleaseFCB(pVCB, parentFCB); - parentFCB = 0; + parentFCB = NULL; } // fail if element in FCB is not a directory if (!vfatFCBIsDirectory(FCB)) @@ -910,6 +910,8 @@ vfatGetFCBForFile( if (FileNameU.Length + parentFCB->LongNameU.Length - Length > FileNameU.MaximumLength) { vfatReleaseFCB(pVCB, parentFCB); + *pParentFCB = NULL; + *pFCB = NULL; return STATUS_OBJECT_NAME_INVALID; } RtlMoveMemory(prev + parentFCB->LongNameU.Length / sizeof(WCHAR), curr,