When we try to cd up two levels using the "../.." notation we
only go up one level. This patch fix this bug.

Cc: Liming Gao <liming....@intel.com>
Cc: Ruiyu Ni <ruiyu...@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qiu Shumin <shumin....@intel.com>
---
 MdePkg/Library/BaseLib/FilePaths.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/MdePkg/Library/BaseLib/FilePaths.c 
b/MdePkg/Library/BaseLib/FilePaths.c
index b7ff480..c72ef72 100644
--- a/MdePkg/Library/BaseLib/FilePaths.c
+++ b/MdePkg/Library/BaseLib/FilePaths.c
@@ -1,7 +1,7 @@
 /** @file
   Defines file-path manipulation functions.
 
-  Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+  Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License
   which accompanies this distribution.  The full text of the license may be 
found at
@@ -96,7 +96,9 @@ PathCleanUpDirectories(
   }
   if ((TempString = StrStr(Path, L"\\..")) != NULL && *(TempString + 3) == 
CHAR_NULL) {
     *TempString = CHAR_NULL;
-    PathRemoveLastItem(Path);
+    if (!PathRemoveLastItem(Path)) {
+      *TempString = L'\\';
+    }
   }
   //
   // Fix up the .
-- 
2.7.1.windows.2

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to