From: Fabian Keil Date: Sun, 23 Aug 2020 16:26:19 +0000 (+0200) Subject: rfc2553_connect_to(): When failing set errno later X-Git-Tag: v_3_0_29~195 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=66e714b2eaf3e446db9c02f8db78dad9bc7ac62f 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 --- 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); }