From 4b48ae4bcdbc137c80b77adc5aa614e5f4cb9f51 Mon Sep 17 00:00:00 2001 From: Sascha Hauer Date: Thu, 29 Nov 2018 11:17:08 +0100 Subject: net: dns: return error codes The resolv() function used to return the IP address. When net_udp_new() fails we return an error code though which the callers of resolv() take as an IP address. This is wrong of course and we could return 0 in this case. Instead we return an error code and pass the resolved IP as a pointer which allows us to return proper error codes. This patch also adds error messages and error returns to the various callers of resolv() which used to just continue with a zero IP and let the user figure out what went wrong. Signed-off-by: Sascha Hauer --- net/net.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'net/net.c') diff --git a/net/net.c b/net/net.c index 63f42fa5cc..f1a7df0298 100644 --- a/net/net.c +++ b/net/net.c @@ -107,7 +107,9 @@ IPaddr_t getenv_ip(const char *name) if (!string_to_ip(var, &ip)) return ip; - return resolv((char*)var); + resolv(var, &ip); + + return ip; } int setenv_ip(const char *name, IPaddr_t ip) -- cgit v1.2.3