]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: tcpcheck: mention that we're a bit far for a sync errno
authorWilly Tarreau <w@1wt.eu>
Mon, 18 May 2026 15:18:34 +0000 (17:18 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 18 May 2026 16:47:41 +0000 (18:47 +0200)
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.

src/tcpcheck.c

index a500dbadffb8ed434996fa163159769bb3744c1e..d354291f1986178aeb810e3288cc7ffc3636efeb 100644 (file)
@@ -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);
        }