From 526b79219ecdf4154d9e79eda2c0cd3b621d622a Mon Sep 17 00:00:00 2001 From: Emeric Brun Date: Mon, 15 Feb 2021 14:28:27 +0100 Subject: [PATCH] BUG/MINOR: dns: dns_connect_server must return -1 unsupported nameserver's type This patch fix returns code in case of dns_connect_server is called on unsupported type (which should not happen). Doing this we have the warranty that after a return 0 the fd is never -1. This patch should fix github issues #1127, #1128 and #1130 --- src/dns.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/dns.c b/src/dns.c index bc40b29e80..e1f9539e99 100644 --- a/src/dns.c +++ b/src/dns.c @@ -75,8 +75,10 @@ static int dns_connect_nameserver(struct dns_nameserver *ns) dgram->t.sock.fd = fd; fd_insert(fd, dgram, dgram_fd_handler, MAX_THREADS_MASK); fd_want_recv(fd); + return 0; } - return 0; + + return -1; } /* Sends a message to a name server -- 2.47.3