]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
w_prometheus: fix libmicrohttpd api change
authorBernd Zeimetz <bernd@bzed.de>
Fri, 24 Jul 2020 08:57:28 +0000 (10:57 +0200)
committerBernd Zeimetz <bernd@bzed.de>
Fri, 24 Jul 2020 08:58:09 +0000 (10:58 +0200)
Closes #3511

src/write_prometheus.c

index b9040223bcc0559855f4f2dd6f9e59cc473fcb53..9d3df08f55e539f90b747b78c0387c685c2c5536 100644 (file)
   "encoding=delimited"
 #define CONTENT_TYPE_TEXT "text/plain; version=0.0.4"
 
+#if MHD_VERSION >= 0x00097002
+#define MHD_RESULT enum MHD_Result
+#else
+#define MHD_RESULT int
+#endif
+
+
 static c_avl_tree_t *metrics;
 static pthread_mutex_t metrics_lock = PTHREAD_MUTEX_INITIALIZER;
 
@@ -227,7 +234,7 @@ static void format_text(ProtobufCBuffer *buffer) {
 
 /* http_handler is the callback called by the microhttpd library. It essentially
  * handles all HTTP request aspects and creates an HTTP response. */
-static int http_handler(void *cls, struct MHD_Connection *connection,
+static MHD_RESULT http_handler(void *cls, struct MHD_Connection *connection,
                         const char *url, const char *method,
                         const char *version, const char *upload_data,
                         size_t *upload_data_size, void **connection_state) {
@@ -268,7 +275,7 @@ static int http_handler(void *cls, struct MHD_Connection *connection,
   MHD_add_response_header(res, MHD_HTTP_HEADER_CONTENT_TYPE,
                           want_proto ? CONTENT_TYPE_PROTO : CONTENT_TYPE_TEXT);
 
-  int status = MHD_queue_response(connection, MHD_HTTP_OK, res);
+  MHD_RESULT status = MHD_queue_response(connection, MHD_HTTP_OK, res);
 
   MHD_destroy_response(res);
   PROTOBUF_C_BUFFER_SIMPLE_CLEAR(&simple);