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
This commit is contained in:
Shumin Qiu 2014-02-12 01:52:27 +00:00 committed by shenshushi
parent a7563b08d9
commit f3a14a0f57
2 changed files with 13 additions and 2 deletions

View File

@ -224,7 +224,18 @@ CopySingleFile(
ASSERT(Buffer != NULL);
while (ReadSize == PcdGet32(PcdShellFileOperationSize) && !EFI_ERROR(Status)) {
Status = ShellReadFile(SourceHandle, &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);