]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtSimpleFileSystemDxe/WinNtSimpleFileSystem.c
fixed one bug causing "sct -u" failure when running at twice or more times.
[mirror_edk2.git] / Nt32Pkg / WinNtSimpleFileSystemDxe / WinNtSimpleFileSystem.c
index 1abb84185e54e252c63b2bfa00d79eeb8ab3bc77..a5559bfc03f5eb9bdaf733d266c5207172b09ee0 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2008, Intel Corporation\r
+Copyright (c) 2006 - 2009, Intel Corporation\r
 All rights reserved. This program and the accompanying materials\r
 are licensed and made available under the terms and conditions of the BSD License\r
 which accompanies this distribution.  The full text of the license may be found at\r
@@ -2469,20 +2469,31 @@ Returns:
   //\r
   // Make full pathname from new filename and rootpath.\r
   //\r
-  Size  = StrSize (PrivateRoot->FilePath);\r
-  Size += StrSize (L"\\");\r
-  Size += StrSize (NewFileInfo->FileName);\r
-  NewFileName = AllocatePool (Size);\r
-  if (NewFileName == NULL) {\r
-    Status = EFI_OUT_OF_RESOURCES;\r
-    goto Done;\r
-  }\r
-\r
-  StrCpy (NewFileName, PrivateRoot->FilePath);\r
-  StrCat (NewFileName, L"\\");\r
   if (NewFileInfo->FileName[0] == '\\') {\r
+    Size  = StrSize (PrivateRoot->FilePath);\r
+    Size += StrSize (L"\\");\r
+    Size += StrSize (NewFileInfo->FileName);\r
+    NewFileName = AllocatePool (Size);\r
+    if (NewFileName == NULL) {\r
+      Status = EFI_OUT_OF_RESOURCES;\r
+      goto Done;\r
+    }\r
+\r
+    StrCpy (NewFileName, PrivateRoot->FilePath);\r
+    StrCat (NewFileName, L"\\");\r
     StrCat (NewFileName, NewFileInfo->FileName + 1);\r
   } else {\r
+    Size  = StrSize (PrivateFile->FilePath);\r
+    Size += StrSize (L"\\");\r
+    Size += StrSize (NewFileInfo->FileName);\r
+    NewFileName = AllocatePool (Size);\r
+    if (NewFileName == NULL) {\r
+      Status = EFI_OUT_OF_RESOURCES;\r
+      goto Done;\r
+    }\r
+\r
+    StrCpy (NewFileName, PrivateFile->FilePath);\r
+    StrCat (NewFileName, L"\\");\r
     StrCat (NewFileName, NewFileInfo->FileName);\r
   }\r
 \r