fix-storing-local-variables
authorCollectd Packaging Team <team+collectd@tracker.debian.org>
Thu, 7 Dec 2023 14:35:28 +0000 (15:35 +0100)
committerBernd Zeimetz <bzed@debian.org>
Thu, 7 Dec 2023 14:35:28 +0000 (15:35 +0100)
===================================================================

Gbp-Pq: Name fix-storing-local-variables

src/capabilities.c
src/write_prometheus.c

index a3a31c1aec197bc5f912d348e1f3ded5d105abb3..644c16bc6e86a6c68534f781427e602a73216b03 100644 (file)
@@ -56,6 +56,8 @@ static char *httpd_host = NULL;
 static unsigned short httpd_port = 9104;
 static struct MHD_Daemon *httpd;
 
+static int mhd_cls = 44;
+
 static dmi_type_name_t types_list[] = {
     {BIOS, "BIOS"},
     {SYSTEM, "SYSTEM"},
@@ -206,7 +208,7 @@ 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};
+    *connection_state = &mhd_cls;
     return MHD_YES;
   }
   DEBUG(CAP_PLUGIN ": formatted response: %s", g_cap_json);
index 7596b555127c1862c21491ed95158645f74206c1..8e02753fa1700ba508d88e1a783945c9f1da876b 100644 (file)
@@ -63,6 +63,7 @@ static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
 static char *httpd_host = NULL;
 static unsigned short httpd_port = 9103;
 static struct MHD_Daemon *httpd;
+static int mhd_cls = 42;
 
 static cdtime_t staleness_delta = PROMETHEUS_DEFAULT_STALENESS_DELTA;
 
@@ -247,7 +248,7 @@ static MHD_RESULT http_handler(void *cls, struct MHD_Connection *connection,
    * very specific on the issue. */
   if (*connection_state == NULL) {
     /* set to a random non-NULL pointer. */
-    *connection_state = &(int){42};
+    *connection_state = &mhd_cls;
     return MHD_YES;
   }