Revision: 17539
http://sourceforge.net/p/edk2/code/17539
Author: oliviermartin
Date: 2015-05-29 14:00:39 +0000 (Fri, 29 May 2015)
Log Message:
-----------
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 <[email protected]>
Reviewed-by: Ronald Cron <[email protected]>
Modified Paths:
--------------
trunk/edk2/ArmPkg/Library/BdsLib/BdsFilePath.c
Modified: trunk/edk2/ArmPkg/Library/BdsLib/BdsFilePath.c
===================================================================
--- trunk/edk2/ArmPkg/Library/BdsLib/BdsFilePath.c 2015-05-29 13:54:21 UTC
(rev 17538)
+++ trunk/edk2/ArmPkg/Library/BdsLib/BdsFilePath.c 2015-05-29 14:00:39 UTC
(rev 17539)
@@ -1038,7 +1038,7 @@
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,18 +1185,11 @@
goto Error;
}
- //
- // Convert the Unicode path of the file to Ascii
- //
+ // 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);
- 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);
-
//
// Try to get the size of the file in bytes from the server. If it fails,
// start with a 8MB buffer to download the file.
@@ -1241,7 +1234,7 @@
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 @@
}
if (EFI_ERROR (Status)) {
+ *Image = 0;
Print (L"Failed to download the file - Error=%r\n", Status);
}
------------------------------------------------------------------------------
_______________________________________________
edk2-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-commits