summaryrefslogtreecommitdiff
path: root/ShellPkg
diff options
context:
space:
mode:
authorOlivier Martin <olivier.martin@arm.com>2015-04-15 18:16:58 +0000
committeroliviermartin <oliviermartin@Edk2>2015-04-15 18:16:58 +0000
commit2ce9792534cebf8a70b110094d4790783da0178b (patch)
treef97736c8d6bbf0ade2773a42fbf57659a3f4f444 /ShellPkg
parent14f3f8821409b60d1a570a683d30c2223eccab64 (diff)
downloadedk2-platforms-2ce9792534cebf8a70b110094d4790783da0178b.tar.xz
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
Diffstat (limited to 'ShellPkg')
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c7
-rw-r--r--ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.unibin109340 -> 109570 bytes
2 files changed, 5 insertions, 2 deletions
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
index ffe1ebce6a..8faa54beee 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Cp.c
@@ -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
diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
index 048845588f..29563d2e21 100644
--- a/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
+++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.uni
Binary files differ