diff options
Diffstat (limited to 'tools/dnsproxy-test.c')
-rw-r--r-- | tools/dnsproxy-test.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/dnsproxy-test.c b/tools/dnsproxy-test.c index 418767a8..551cae91 100644 --- a/tools/dnsproxy-test.c +++ b/tools/dnsproxy-test.c @@ -147,6 +147,9 @@ static int connect_tcp_socket(char *server) if (sk >= 0 && connect(sk, rp->ai_addr, rp->ai_addrlen) < 0) { err = -errno; + close(sk); + sk = -1; + fprintf(stderr, "Failed to connect to DNS server at %s " "errno %d/%s\n", server, -err, strerror(-err)); @@ -237,7 +240,7 @@ static int sendto_msg(int sk, struct sockaddr *sa, socklen_t salen, return 0; } -static unsigned short get_id() +static unsigned short get_id(void) { return random(); } |