summaryrefslogtreecommitdiffstats
path: root/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
diff options
context:
space:
mode:
authorQiu Shumin <shumin.qiu@intel.com>2015-10-23 02:03:20 +0000
committershenshushi <shenshushi@Edk2>2015-10-23 02:03:20 +0000
commitfbd2dfadfe6fb16ab7b49fca3764e05e65d97b8a (patch)
tree62be65e0eb87049beeb36b8ac95c2f127ce13c72 /ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
parenta7e173b07a1ef336fc8d753cf85ae8473e92365a (diff)
downloadedk2-fbd2dfadfe6fb16ab7b49fca3764e05e65d97b8a.tar.gz
edk2-fbd2dfadfe6fb16ab7b49fca3764e05e65d97b8a.tar.bz2
edk2-fbd2dfadfe6fb16ab7b49fca3764e05e65d97b8a.zip
ShellPkg: Follow spec to remove the last '\' char in return name of GetCurDir().
In Shell spec 2.1 the return name of EFI_SHELL_PROTOCOL.GetCurDir() is defined as 'fs0:\current-dir' while in current implementation it's 'fs0:\current-dir\'. To follow spec the patch removed the redundant '\' char. Since it has been broken for a long time, some codes may depend on the broken behavior. After this change 'EFI_SHELL_PROTOCOL.GetCurDir()' and 'UefiShellLib.ShellGetCurrentDir()' will return a current directory string without tailing '\' (fs0:\current-dir), the value of Shell environment variable 'cwd' will become 'fs0:\current-dir' as well. This patch has updated all the code in EDKII to make them depend on the new behavior. Developers should check whether 'GetCurDir()' and 'ShellGetCurrentDir' are used in their source code. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Qiu Shumin <shumin.qiu@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18653 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
index c1e2887aa1..25bf8ca9e1 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Ls.c
@@ -2,7 +2,7 @@
Main file for ls shell level 2 function.
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2015, 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
@@ -669,6 +669,8 @@ ShellCommandRunLs (
ASSERT(FullPath == NULL);
StrnCatGrow(&SearchString, NULL, L"*", 0);
StrnCatGrow(&FullPath, NULL, CurDir, 0);
+ Size = FullPath != NULL? StrSize(FullPath) : 0;
+ StrnCatGrow(&FullPath, &Size, L"\\", 0);
} else {
if (StrStr(PathName, L":") == NULL && gEfiShellProtocol->GetCurDir(NULL) == NULL) {
//
@@ -687,6 +689,8 @@ ShellCommandRunLs (
ShellCommandLineFreeVarList (Package);
return SHELL_OUT_OF_RESOURCES;
}
+ Size = FullPath != NULL? StrSize(FullPath) : 0;
+ StrnCatGrow(&FullPath, &Size, L"\\", 0);
}
StrnCatGrow(&FullPath, &Size, PathName, 0);
if (FullPath == NULL) {