ShellPkg/UefiShellLevel2CommandsLib: Handle the returned error

If this function fails in release build then the error was
not handled and SourceHandle was not valid.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <olivier.martin@arm.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17184 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Olivier Martin 2015-04-15 18:16:58 +00:00 committed by oliviermartin
parent 14f3f88214
commit 2ce9792534
2 changed files with 5 additions and 2 deletions

View File

@ -170,8 +170,11 @@ CopySingleFile(
//
// open source file
//
Status = ShellOpenFileByName(Source, &SourceHandle, EFI_FILE_MODE_READ, 0);
ASSERT_EFI_ERROR(Status);
Status = ShellOpenFileByName (Source, &SourceHandle, EFI_FILE_MODE_READ, 0);
if (EFI_ERROR (Status)) {
ShellPrintHiiEx (-1, -1, NULL, STRING_TOKEN (STR_CP_SRC_OPEN_FAIL), gShellLevel2HiiHandle, CmdName, Source);
return (SHELL_ACCESS_DENIED);
}
//
//get file size of source file and freespace available on destination volume