summaryrefslogtreecommitdiff
path: root/ArmPkg/Library
diff options
context:
space:
mode:
authorOlivier Martin <Olivier.Martin@arm.com>2015-05-29 14:00:39 +0000
committeroliviermartin <oliviermartin@Edk2>2015-05-29 14:00:39 +0000
commit9d8ee7815ca7ce02555e17b60b2672674a059ce4 (patch)
treefee0b78cb2e4242da35b0c083316ec21b3a99229 /ArmPkg/Library
parent90cd0f1ad713e46087aa7c3c81816fa2b17bcf1b (diff)
downloadedk2-9d8ee7815ca7ce02555e17b60b2672674a059ce4.zip
edk2-9d8ee7815ca7ce02555e17b60b2672674a059ce4.tar.gz
edk2-9d8ee7815ca7ce02555e17b60b2672674a059ce4.tar.bz2
ArmPkg/BdsLib: Fixed TFTP when there are directories in the name
The TFTP Device Path might contain a list of File Path device path nodes. ConvertDevicePathToText() allows to concatenate these File Path nodes. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Olivier Martin <Olivier.Martin@arm.com> Reviewed-by: Ronald Cron <Ronald.Cron@arm.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@17539 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ArmPkg/Library')
-rw-r--r--ArmPkg/Library/BdsLib/BdsFilePath.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/ArmPkg/Library/BdsLib/BdsFilePath.c b/ArmPkg/Library/BdsLib/BdsFilePath.c
index 53af9ee..ff42175 100644
--- a/ArmPkg/Library/BdsLib/BdsFilePath.c
+++ b/ArmPkg/Library/BdsLib/BdsFilePath.c
@@ -1038,7 +1038,7 @@ BdsTftpLoadImage (
EFI_DHCP4_MODE_DATA Dhcp4Mode;
EFI_MTFTP4_CONFIG_DATA Mtftp4CfgData;
IPv4_DEVICE_PATH *IPv4DevicePathNode;
- FILEPATH_DEVICE_PATH *FilePathDevicePathNode;
+ CHAR16 *PathName;
CHAR8 *AsciiFilePath;
EFI_MTFTP4_TOKEN Mtftp4Token;
UINT64 FileSize;
@@ -1185,17 +1185,10 @@ BdsTftpLoadImage (
goto Error;
}
- //
- // Convert the Unicode path of the file to Ascii
- //
-
- FilePathDevicePathNode = (FILEPATH_DEVICE_PATH*)(IPv4DevicePathNode + 1);
- AsciiFilePath = AllocatePool ((StrLen (FilePathDevicePathNode->PathName) + 1) * sizeof (CHAR8));
- if (AsciiFilePath == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
- goto Error;
- }
- UnicodeStrToAsciiStr (FilePathDevicePathNode->PathName, AsciiFilePath);
+ // The Device Path might contain multiple FilePath nodes
+ PathName = ConvertDevicePathToText ((EFI_DEVICE_PATH_PROTOCOL*)(IPv4DevicePathNode + 1), FALSE, FALSE);
+ AsciiFilePath = AllocatePool (StrLen (PathName) + 1);
+ UnicodeStrToAsciiStr (PathName, AsciiFilePath);
//
// Try to get the size of the file in bytes from the server. If it fails,
@@ -1241,7 +1234,7 @@ BdsTftpLoadImage (
Mtftp4Token.CheckPacket = Mtftp4CheckPacket;
Mtftp4Token.Context = (VOID*)TftpContext;
- Print (L"Downloading the file <%s> from the TFTP server\n", FilePathDevicePathNode->PathName);
+ Print (L"Downloading the file <%a> from the TFTP server\n", AsciiFilePath);
Status = Mtftp4->ReadFile (Mtftp4, &Mtftp4Token);
Print (L"\n");
if (EFI_ERROR (Status)) {
@@ -1303,6 +1296,7 @@ Error:
}
if (EFI_ERROR (Status)) {
+ *Image = 0;
Print (L"Failed to download the file - Error=%r\n", Status);
}