net: wget: make wget_with_dns return value compatible with its lwip version
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>
This commit is contained in:

committed by
Heinrich Schuchardt

parent
2dd076a9c1
commit
de28a2a5f2
@@ -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
|
* @dst_addr: destination address to download the file
|
||||||
* @uri: uri string of target file of wget
|
* @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);
|
int wget_with_dns(ulong dst_addr, char *uri);
|
||||||
/**
|
/**
|
||||||
|
@@ -16,15 +16,6 @@ void net_lwip_remove_netif(struct netif *netif);
|
|||||||
struct netif *net_lwip_get_netif(void);
|
struct netif *net_lwip_get_netif(void);
|
||||||
int net_lwip_rx(struct udevice *udev, struct netif *netif);
|
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
|
* wget_validate_uri() - varidate the uri
|
||||||
*
|
*
|
||||||
|
@@ -579,7 +579,7 @@ int wget_with_dns(ulong dst_addr, char *uri)
|
|||||||
out:
|
out:
|
||||||
free(str_copy);
|
free(str_copy);
|
||||||
|
|
||||||
return ret;
|
return ret < 0 ? ret : 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user