From 31a8306b932a78805d9b5018e5897ef8965eba12 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Fri, 28 Jan 2022 09:36:35 +0100 Subject: [PATCH] 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. --- src/mux_fcgi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/mux_fcgi.c b/src/mux_fcgi.c index ba3a54617..fa9e3adb9 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),