[PATCH 5/7] net: wget: make wget_with_dns return value compatible with its lwip version
Heinrich Schuchardt
xypron.glpk at gmx.de
Fri Nov 8 18:32:39 CET 2024
On 11/6/24 14:04, Adriano Cordova wrote:
> There are two wget_with_dns functions, one in the legacy network
> stack and one in lwip, but the return values are not compatible.
> This commit modifies the legacy version of wget_with_dns so that
> the return values are compatible: 0 on success, otherwise a negative
> error. This way wget_with_dns can be called in a network stack
> agnostic way.
>
> Signed-off-by: Adriano Cordova <adrianox at gmail.com>
> ---
> net/wget.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/wget.c b/net/wget.c
> index 24be0a4932..6cf721070b 100644
> --- a/net/wget.c
> +++ b/net/wget.c
> @@ -576,7 +576,7 @@ int wget_with_dns(ulong dst_addr, char *uri)
> out:
> free(str_copy);
>
> - return ret;
> + return ret < 0 ? ret : 0;
include/net-lwip.h descibes wget with dns() as
Return: downloaded file size, negative if failed
There is a second definition in net/common.h with
Return: downloaded file size, negative if failed
Your change does not match the declaration in the includes.
The function should only be defined in one include, i.e. net_common.h.
Function try_load_from_uri_path() uses
env_get_hex("filesize", 0)
to retrieve the file size. Isn't it be preferable to use the return
value of wget with dns() instead?
There is ongoing work to load installation images via http and boot from
these. If we return the filesize, the return type should be ssize_t to
avoid a 2 GiB limit on the filesize.
Best regards
Heinrich
> }
> #endif
>
More information about the U-Boot
mailing list