Revision: 14441
          http://sourceforge.net/p/edk2/code/14441
Author:   jcarsey
Date:     2013-06-21 21:20:03 +0000 (Fri, 21 Jun 2013)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Eugene Cohen <[email protected]>

Modified Paths:
--------------
    trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c

Modified: trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c
===================================================================
--- trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c 2013-06-21 
11:08:17 UTC (rev 14440)
+++ trunk/edk2/ShellPkg/Library/UefiShellLevel2CommandsLib/Rm.c 2013-06-21 
21:20:03 UTC (rev 14441)
@@ -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 @@
   EFI_SHELL_FILE_INFO   *Node2;
   EFI_STATUS            Status;
   SHELL_PROMPT_RESPONSE *Resp;
+  CHAR16                *TempName;
 
   Resp                  = NULL;
   ShellStatus           = SHELL_SUCCESS;
@@ -120,6 +121,22 @@
           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) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to