summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorJaben Carsey <Jaben.carsey@intel.com>2013-06-21 21:20:03 +0000
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>2013-06-21 21:20:03 +0000
commit22feb630eb1bbe975c4c14ff859156dcbf6f87e3 (patch)
tree5e816feff67be55a935b3e9929a060c66dbbd6ab /ShellPkg
parente7c578c9028b570ddcc20997723b1e8922e46062 (diff)
downloadedk2-platforms-22feb630eb1bbe975c4c14ff859156dcbf6f87e3.tar.xz
ShellPkg: Update rm command to properly prepend file system identifiers to filenames.
This is required when recursively removing directories with files on file systems other than the current one. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey <Jaben.carsey@intel.com> Reviewed-by: Eugene Cohen <eugene@hp.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14441 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
index 2eb54d3e39..e1473cf907 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
@@ -1,7 +1,7 @@
/** @file
Main file for attrib shell level 2 function.
- Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2009 - 2013, 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
@@ -75,6 +75,7 @@ CascadeDelete(
EFI_SHELL_FILE_INFO *Node2;
EFI_STATUS Status;
SHELL_PROMPT_RESPONSE *Resp;
+ CHAR16 *TempName;
Resp = NULL;
ShellStatus = SHELL_SUCCESS;
@@ -120,6 +121,22 @@ CascadeDelete(
continue;
}
Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
+ if (EFI_ERROR(Node2->Status) && StrStr(Node2->FileName, L":") == NULL) {
+ //
+ // Update the node filename to have full path with file system identifier
+ //
+ TempName = AllocateZeroPool(StrSize(Node->FullName) + StrSize(Node2->FullName));
+ StrCpy(TempName, Node->FullName);
+ TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL;
+ StrCat(TempName, Node2->FullName);
+ FreePool((VOID*)Node2->FullName);
+ Node2->FullName = TempName;
+
+ //
+ // Now try again to open the file
+ //
+ Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
+ }
ShellStatus = CascadeDelete(Node2, Quiet);
if (ShellStatus != SHELL_SUCCESS) {
if (List!=NULL) {