mirror of https://github.com/acidanthera/audk.git
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:
parent
a7563b08d9
commit
f3a14a0f57
|
@ -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
|
||||
//
|
||||
|
|
Binary file not shown.
Loading…
Reference in New Issue