diff options
author | Shumin Qiu <shumin.qiu@intel.com> | 2014-02-12 01:52:27 +0000 |
---|---|---|
committer | shenshushi <shenshushi@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-02-12 01:52:27 +0000 |
commit | f3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41 (patch) | |
tree | e6fe3e5280d5011994938fe5f9a0f4e5ace81929 /ShellPkg | |
parent | a7563b08d937bf6cf2c751b753b7743381c73c6c (diff) | |
download | edk2-f3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41.zip edk2-f3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41.tar.gz edk2-f3a14a0f575e7e856ff4d90d7d0ab73f7e02ae41.tar.bz2 |
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.c | 15 | ||||
-rw-r--r-- | ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni | bin | 111846 -> 112254 bytes |
2 files changed, 13 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c index ae36807..8fc263f 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 Binary files differindex f099150..a640915 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni |