]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Add code to check the return status for ShellReadFile and ShellWriteFile when execute...
authorShumin Qiu <shumin.qiu@intel.com>
Wed, 12 Feb 2014 01:52:27 +0000 (01:52 +0000)
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 12 Feb 2014 01:52:27 +0000 (01:52 +0000)
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Shumin Qiu <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@15231 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni

index ae36807958ffafecbf6f9b3abffa67a286e9b6a5..8fc263f6ba377ca79f24764a02612ea16a111759 100644 (file)
@@ -224,12 +224,23 @@ CopySingleFile(
       ASSERT(Buffer != NULL);\r
       while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {\r
         Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);\r
-        Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);\r
+        if (!EFI_ERROR(Status)) {\r
+          Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);\r
+          if (EFI_ERROR(Status)) {\r
+            ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+            ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, Dest);\r
+            break;\r
+          }\r
+        } else {\r
+          ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));\r
+          ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, Source);\r
+          break;\r
+        }\r
       }\r
     }\r
     SHELL_FREE_NON_NULL(DestVolumeInfo);\r
   }\r
-\r
+  \r
   //\r
   // close files\r
   //\r
index f0991507c402826c6443005ed6d95312cc44e14d..a64091591e0e9542ba030ac7b2047f05526418b4 100644 (file)
Binary files a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni and b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni differ