From 71c97781eb35db97e44f23f61618f161f8d03f94 Mon Sep 17 00:00:00 2001 From: Collectd Packaging Team Date: Mon, 20 Feb 2023 12:55:26 +0000 Subject: [PATCH] fix-storing-local-variables =================================================================== Gbp-Pq: Name fix-storing-local-variables --- src/capabilities.c | 4 +++- src/write_prometheus.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/capabilities.c b/src/capabilities.c index a3a31c1..644c16b 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -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); diff --git a/src/write_prometheus.c b/src/write_prometheus.c index 7596b55..8e02753 100644 --- a/src/write_prometheus.c +++ b/src/write_prometheus.c @@ -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; } -- 2.30.2