aboutsummaryrefslogtreecommitdiffstats
path: root/Library/UefiShellUfmCommandLib
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2021-12-13 21:50:31 +0300
committerJoursoir <chat@joursoir.net>2021-12-13 21:50:31 +0300
commit722a438a60827f99f48d41aae3daccd8c7d73ab1 (patch)
treec345feb1d994a63317cf35d58e08c93e182f7c56 /Library/UefiShellUfmCommandLib
parent5abed58efcf6c739c473179255815270413a586b (diff)
downloadufm-722a438a60827f99f48d41aae3daccd8c7d73ab1.tar.gz
ufm-722a438a60827f99f48d41aae3daccd8c7d73ab1.tar.bz2
ufm-722a438a60827f99f48d41aae3daccd8c7d73ab1.zip
cmds: make error handling when opening a directory
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;
}