]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: wget: make wget_with_dns return value compatible with its lwip version
authorAdriano Cordova <adrianox@gmail.com>
Mon, 11 Nov 2024 21:08:59 +0000 (18:08 -0300)
committerHeinrich Schuchardt <heinrich.schuchardt@canonical.com>
Sat, 16 Nov 2024 20:35:05 +0000 (21:35 +0100)
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@gmail.com>
include/net-common.h
include/net-lwip.h
net/wget.c

index 1efb0db9ff5f3c7130fcacc1cd8b9371a710dd00..3cd0f34374400e3e217e930245cc41f0cc40c7b7 100644 (file)
@@ -495,7 +495,7 @@ int do_tftpb(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]);
  *
  * @dst_addr:  destination address to download the file
  * @uri:       uri string of target file of wget
- * Return:     downloaded file size, negative if failed
+ * Return:     zero on success, negative if failed
  */
 int wget_with_dns(ulong dst_addr, char *uri);
 /**
index 1c3583f82a1a5fec4fc4e5238c95ac88d22d3f77..4d7f9387d1d1ad3207bc5e034a9d0a3d93037c45 100644 (file)
@@ -16,15 +16,6 @@ void net_lwip_remove_netif(struct netif *netif);
 struct netif *net_lwip_get_netif(void);
 int net_lwip_rx(struct udevice *udev, struct netif *netif);
 
-/**
- * wget_with_dns() - runs dns host IP address resulution before wget
- *
- * @dst_addr:  destination address to download the file
- * @uri:       uri string of target file of wget
- * Return:     downloaded file size, negative if failed
- */
-
-int wget_with_dns(ulong dst_addr, char *uri);
 /**
  * wget_validate_uri() - varidate the uri
  *
index 21f1875866420aa5235a4a4b202f5001d9e3494d..3bc2522cde5a05da8f41ad2bb62c0aa9ad501378 100644 (file)
@@ -579,7 +579,7 @@ int wget_with_dns(ulong dst_addr, char *uri)
 out:
        free(str_copy);
 
-       return ret;
+       return ret < 0 ? ret : 0;
 }
 #endif