summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorShumin Qiu <shumin.qiu@intel.com>2014-02-12 01:52:27 +0000
committershenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524>2014-02-12 01:52:27 +0000
commitf3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41 (patch)
treee6fe3e5280d5011994938fe5f9a0f4e5ace81929 /ShellPkg
parenta7563b08d937bf6cf2c751b753b7743381c73c6c (diff)
downloadedk2-platforms-f3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41.tar.xz
Add code to check the return status for ShellReadFile and ShellWriteFile when execute the 'cp' command.
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
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c15
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.unibin111846 -> 112254 bytes
2 files changed, 13 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index ae36807958..8fc263f6ba 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -224,12 +224,23 @@ CopySingleFile(
ASSERT(Buffer != NULL);
while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
Status = ShellReadFile(SourceHandle, &ReadSize, Buffer);
- Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
+ if (!EFI_ERROR(Status)) {
+ Status = ShellWriteFile(DestHandle, &ReadSize, Buffer);
+ if (EFI_ERROR(Status)) {
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_WRITE_ERROR), gShellLevel2HiiHandle, Dest);
+ break;
+ }
+ } else {
+ ShellStatus = (SHELL_STATUS) (Status & (~MAX_BIT));
+ ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_CPY_READ_ERROR), gShellLevel2HiiHandle, Source);
+ break;
+ }
}
}
SHELL_FREE_NON_NULL(DestVolumeInfo);
}
-
+
//
// close files
//
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
index f0991507c4..a64091591e 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
Binary files differ