mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] net: dns: Return error when nameserver not given
@ 2022-06-13  7:05 Sascha Hauer
  0 siblings, 0 replies; only message in thread
From: Sascha Hauer @ 2022-06-13  7:05 UTC (permalink / raw)
  To: Barebox List

When no nameserver is given then return an error instead of returning
successfully with 0.0.0.0 as return IP.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 net/dns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dns.c b/net/dns.c
index 8b5e8d59e8..fdddb3f915 100644
--- a/net/dns.c
+++ b/net/dns.c
@@ -226,7 +226,7 @@ int resolv(const char *host, IPaddr_t *ip)
 	nameserver = net_get_nameserver();
 	if (!nameserver) {
 		pr_err("no nameserver specified in $global.net.nameserver\n");
-		return 0;
+		return -ENOENT;
 	}
 
 	pr_debug("resolving host %s via nameserver %pI4\n", host, &nameserver);
-- 
2.30.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-06-13  7:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-13  7:05 [PATCH] net: dns: Return error when nameserver not given Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox