From: Ismael Luceno Date: Mon, 15 Aug 2022 12:25:26 +0000 (+0200) Subject: Fix anonymous connection_state pointer X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7da05ec20128b45b4b97c769562f8db76ec14be;p=thirdparty%2Fcollectd.git Fix anonymous connection_state pointer Returning an anonymous pointer (which is limited to the scope of the function) causes a build error with -Werror. Signed-off-by: Ismael Luceno --- diff --git a/src/capabilities.c b/src/capabilities.c index a3a31c1ae..f0f3e5f04 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -206,7 +206,8 @@ static MHD_RESULT cap_http_handler(void *cls, struct MHD_Connection *connection, * round. The docs are not very specific on the issue. */ if (*connection_state == NULL) { /* set to a random non-NULL pointer. */ - *connection_state = &(int){44}; + static int rnd_state = 44; + *connection_state = &rnd_state; return MHD_YES; } DEBUG(CAP_PLUGIN ": formatted response: %s", g_cap_json);