From: Willy Tarreau Date: Mon, 18 May 2026 15:18:34 +0000 (+0200) Subject: CLEANUP: tcpcheck: mention that we're a bit far for a sync errno X-Git-Tag: v3.4-dev13~51 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bbc41785d9099815479808b2e49d8dccdb067815;p=thirdparty%2Fhaproxy.git CLEANUP: tcpcheck: mention that we're a bit far for a sync errno The collection of errno in tcpcheck_eval_connect() and tcpcheck_main() is quite far from the production location, and the risk of having a zero errno is definitely not null. Tests show that this works, so better not try to fix something not broken, but at least place a comment there indicating that it's not necessarily super-reliable. This would need to be revisited the day we finally store errno in the connection. --- diff --git a/src/tcpcheck.c b/src/tcpcheck.c index a500dbadf..d354291f1 100644 --- a/src/tcpcheck.c +++ b/src/tcpcheck.c @@ -1611,6 +1611,7 @@ enum tcpcheck_eval_ret tcpcheck_eval_connect(struct check *check, struct tcpchec case SF_ERR_RESOURCE: case SF_ERR_INTERNAL: TRACE_ERROR("report connection error", CHK_EV_TCPCHK_CONN|CHK_EV_TCPCHK_ERR, check, 0, 0, (size_t[]){status}); + /* note: errno is no longer guaranteed here */ chk_report_conn_err(check, errno, 0); ret = TCPCHK_EVAL_STOP; goto out; @@ -2648,6 +2649,7 @@ int tcpcheck_main(struct check *check) out_end_tcpcheck: if ((conn && conn->flags & CO_FL_ERROR) || sc_ep_test(sc, SE_FL_ERROR)) { TRACE_ERROR("report connection error", CHK_EV_TCPCHK_EVAL|CHK_EV_TCPCHK_ERR, check); + /* note: errno is no longer guaranteed here */ chk_report_conn_err(check, errno, 0); }