mirror of https://github.com/acidanthera/audk.git
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
This commit is contained in:
parent
e7c578c902
commit
22feb630eb
|
@ -1,7 +1,7 @@
|
||||||
/** @file
|
/** @file
|
||||||
Main file for attrib shell level 2 function.
|
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
|
This program and the accompanying materials
|
||||||
are licensed and made available under the terms and conditions of the BSD License
|
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
|
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_SHELL_FILE_INFO *Node2;
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
SHELL_PROMPT_RESPONSE *Resp;
|
SHELL_PROMPT_RESPONSE *Resp;
|
||||||
|
CHAR16 *TempName;
|
||||||
|
|
||||||
Resp = NULL;
|
Resp = NULL;
|
||||||
ShellStatus = SHELL_SUCCESS;
|
ShellStatus = SHELL_SUCCESS;
|
||||||
|
@ -120,6 +121,22 @@ CascadeDelete(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);
|
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);
|
ShellStatus = CascadeDelete(Node2, Quiet);
|
||||||
if (ShellStatus != SHELL_SUCCESS) {
|
if (ShellStatus != SHELL_SUCCESS) {
|
||||||
if (List!=NULL) {
|
if (List!=NULL) {
|
||||||
|
|
Loading…
Reference in New Issue