https://git.reactos.org/?p=reactos.git;a=commitdiff;h=52f0f80a83dfd1f751c3d6228a2c246606078974

commit 52f0f80a83dfd1f751c3d6228a2c246606078974
Author:     Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sat Jun 9 22:17:17 2018 +0200
Commit:     Pierre Schweitzer <pie...@reactos.org>
CommitDate: Sat Jun 9 22:17:17 2018 +0200

    [FASTFAT] Don't add an extra \, when renaming a file at root.
    
    This fixes failures to rename a file where destination is
    the root of a FAT volume.
    
    CORE-10503
---
 drivers/filesystems/fastfat/finfo.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/filesystems/fastfat/finfo.c 
b/drivers/filesystems/fastfat/finfo.c
index 517d7381d6..a19c21db55 100644
--- a/drivers/filesystems/fastfat/finfo.c
+++ b/drivers/filesystems/fastfat/finfo.c
@@ -787,8 +787,12 @@ VfatSetRenameInformation(
         }
 
         RtlCopyUnicodeString(&NewName, 
&((PVFATFCB)TargetFileObject->FsContext)->PathNameU);
-        NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
-        NewName.Length += sizeof(WCHAR);
+        /* If \, it's already backslash terminated, don't add it */
+        if (!vfatFCBIsRoot(TargetFileObject->FsContext))
+        {
+            NewName.Buffer[NewName.Length / sizeof(WCHAR)] = L'\\';
+            NewName.Length += sizeof(WCHAR);
+        }
         RtlAppendUnicodeStringToString(&NewName, &TargetFileObject->FileName);
     }
 

Reply via email to