aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib
diff options
context:
space:
mode:
Diffstat (limited to 'Library/UefiShellUfmCommandLib')
-rw-r--r--Library/UefiShellUfmCommandLib/cmds.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/Library/UefiShellUfmCommandLib/cmds.c b/Library/UefiShellUfmCommandLib/cmds.c
index 8f0b486..8a9c425 100644
--- a/Library/UefiShellUfmCommandLib/cmds.c
+++ b/Library/UefiShellUfmCommandLib/cmds.c
@@ -94,18 +94,19 @@ EFI_STATUS copy_file(CONST CHAR16 *src, CONST CHAR16 *dest)
if(EFI_ERROR(status))
return EFI_ACCESS_DENIED;
- temp_name = NULL;
StrnCatGrow(&temp_name, &size, src, 0);
StrnCatGrow(&temp_name, &size, L"\\*", 0);
if(temp_name == NULL)
return EFI_OUT_OF_RESOURCES;
- ShellOpenFileMetaArg(temp_name, EFI_FILE_MODE_READ, &list);
- *temp_name = CHAR_NULL;
- StrnCatGrow(&temp_name, &size, dest, 0);
- StrnCatGrow(&temp_name, &size, L"\\", 0);
- // TODO: copy directory entries
- ShellCloseFileMetaArg(&list);
+ status = ShellOpenFileMetaArg(temp_name, EFI_FILE_MODE_READ, &list);
+ if(!EFI_ERROR(status)) {
+ *temp_name = CHAR_NULL;
+ StrnCatGrow(&temp_name, &size, dest, 0);
+ StrnCatGrow(&temp_name, &size, L"\\", 0);
+ // TODO: copy directory entries
+ ShellCloseFileMetaArg(&list);
+ }
SHELL_FREE_NON_NULL(temp_name);
return status;
}