]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ShellPkg: Update rm command to properly prepend file system identifiers to filenames.
authorJaben Carsey <Jaben.carsey@intel.com>
Fri, 21 Jun 2013 21:20:03 +0000 (21:20 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 21 Jun 2013 21:20:03 +0000 (21:20 +0000)
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

ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c

index 2eb54d3e393a992e6831243f491c6111690b456a..e1473cf907fd76338799ce19d93f4a670216ba3a 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for attrib shell level 2 function.\r
 \r
-  Copyright (c) 2009 - 2012, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
   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
@@ -75,6 +75,7 @@ CascadeDelete(
   EFI_SHELL_FILE_INFO   *Node2;\r
   EFI_STATUS            Status;\r
   SHELL_PROMPT_RESPONSE *Resp;\r
+  CHAR16                *TempName;\r
 \r
   Resp                  = NULL;\r
   ShellStatus           = SHELL_SUCCESS;\r
@@ -120,6 +121,22 @@ CascadeDelete(
           continue;\r
         }\r
         Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);\r
+        if (EFI_ERROR(Node2->Status) && StrStr(Node2->FileName, L":") == NULL) {\r
+          //\r
+          // Update the node filename to have full path with file system identifier\r
+          //\r
+          TempName = AllocateZeroPool(StrSize(Node->FullName) + StrSize(Node2->FullName));\r
+          StrCpy(TempName, Node->FullName);\r
+          TempName[StrStr(TempName, L":")+1-TempName] = CHAR_NULL;\r
+          StrCat(TempName, Node2->FullName);\r
+          FreePool((VOID*)Node2->FullName);\r
+          Node2->FullName = TempName;\r
+\r
+          //\r
+          // Now try again to open the file\r
+          //\r
+          Node2->Status = gEfiShellProtocol->OpenFileByName (Node2->FullName, &Node2->Handle, EFI_FILE_MODE_READ|EFI_FILE_MODE_WRITE);\r
+        }\r
         ShellStatus = CascadeDelete(Node2, Quiet);\r
         if (ShellStatus != SHELL_SUCCESS) {\r
           if (List!=NULL) {\r