From 66e714b2eaf3e446db9c02f8db78dad9bc7ac62f Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sun, 23 Aug 2020 18:26:19 +0200 Subject: [PATCH] rfc2553_connect_to(): When failing set errno later ... to reduce the chances that it gets cloberred before the caller has a chance to read it. Previously Privoxy could send a "Connection failure" message instead of the "DNS failure" message. Sponsored by: Robert Klemme --- jbsockets.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jbsockets.c b/jbsockets.c index 556c927b..5e4b28c7 100644 --- a/jbsockets.c +++ b/jbsockets.c @@ -254,10 +254,10 @@ static jb_socket rfc2553_connect_to(const char *host, int portnum, struct client { log_error(LOG_LEVEL_INFO, "Can not resolve %s: %s", host, gai_strerror(retval)); - /* XXX: Should find a better way to propagate this error. */ - errno = EINVAL; csp->error_message = strdup(gai_strerror(retval)); csp->http->host_ip_addr_str = strdup("unknown"); + /* XXX: Should find a better way to propagate this error. */ + errno = EINVAL; return(JB_INVALID_SOCKET); } -- 2.39.2