]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
Fix anonymous connection_state pointer
authorIsmael Luceno <ismael@iodev.co.uk>
Mon, 15 Aug 2022 12:25:26 +0000 (14:25 +0200)
committerMatthias Runge <mrunge@matthias-runge.de>
Mon, 12 Sep 2022 12:12:32 +0000 (14:12 +0200)
Returning an anonymous pointer (which is limited to the scope of the
function) causes a build error with -Werror.

Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
src/capabilities.c

index a3a31c1aec197bc5f912d348e1f3ded5d105abb3..f0f3e5f046eaea40032ede9ab6f18545f8e5e6f9 100644 (file)
@@ -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);