From: Willy Tarreau Date: Fri, 28 Jan 2022 08:36:35 +0000 (+0100) Subject: BUILD: mux_fcgi: avoid aliasing of a const struct in traces X-Git-Tag: v2.6-dev1~30 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=31a8306b932a78805d9b5018e5897ef8965eba12;p=thirdparty%2Fhaproxy.git BUILD: mux_fcgi: avoid aliasing of a const struct in traces fcgi_trace() declares fconn as a const and casts its mbuf array to (struct buffer*), which rightfully upsets some older compilers. Better just declare it as a writable variable and get rid of the cast. It's harmless anyway. This has been there since 2.1 with commit 5c0f859c2 ("MINOR: mux-fcgi/trace: Register a new trace source with its events") and doens't need to be backported though it would not harm either. --- diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index ba3a546177..fa9e3adb96 100644 --- a/src/mux_fcgi.c +++ b/src/mux_fcgi.c @@ -425,7 +425,7 @@ static void fcgi_trace(enum trace_level level, uint64_t mask, const struct trace const void *a1, const void *a2, const void *a3, const void *a4) { const struct connection *conn = a1; - const struct fcgi_conn *fconn = conn ? conn->ctx : NULL; + struct fcgi_conn *fconn = conn ? conn->ctx : NULL; const struct fcgi_strm *fstrm = a2; const struct htx *htx = a3; const size_t *val = a4; @@ -482,8 +482,8 @@ static void fcgi_trace(enum trace_level level, uint64_t mask, const struct trace (unsigned int)b_head_ofs(&fconn->dbuf), (unsigned int)b_size(&fconn->dbuf)); if (src->verbosity == FCGI_VERB_COMPLETE || (src->verbosity == FCGI_VERB_ADVANCED && (mask & (FCGI_EV_FCONN_SEND|FCGI_EV_TX_RECORD)))) { - struct buffer *hmbuf = br_head((struct buffer *)fconn->mbuf); - struct buffer *tmbuf = br_tail((struct buffer *)fconn->mbuf); + struct buffer *hmbuf = br_head(fconn->mbuf); + struct buffer *tmbuf = br_tail(fconn->mbuf); chunk_appendf(&trace_buf, " .mbuf=[%u..%u|%u],h=[%u@%p+%u/%u],t=[%u@%p+%u/%u]", br_head_idx(fconn->mbuf), br_tail_idx(fconn->mbuf), br_size(fconn->mbuf),