elfutils/elfutils-0.180-mhd-result.patch
2020-07-03 23:50:32 +02:00

68 lines
2.1 KiB
Diff

commit acb453851c9e6c46531b70fda7396885c0e7e1db
Author: Frank Ch. Eigler <fche@redhat.com>
Date: Thu Jul 2 14:52:48 2020 +0000
PR26195: adapt debuginfod to API change in libmicrohttpd-0.9.71
To make our code build with -Werror as well as against older libmicrohttpd,
we must conditionalize the data type (int vs. enum) returned by callbacks
and some mhd functions.
Signed-off-by: Frank Ch. Eigler <fche@redhat.com>
diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx
index 76f1fa52..56210302 100644
--- a/debuginfod/debuginfod.cxx
+++ b/debuginfod/debuginfod.cxx
@@ -92,6 +92,14 @@ using namespace std;
#include <libdwelf.h>
#include <microhttpd.h>
+
+#if MHD_VERSION >= 0x00097002
+// libmicrohttpd 0.9.71 broke API
+#define MHD_RESULT enum MHD_Result
+#else
+#define MHD_RESULT int
+#endif
+
#include <curl/curl.h>
#include <archive.h>
#include <archive_entry.h>
@@ -519,12 +527,12 @@ struct reportable_exception
void report(ostream& o) const; // defined under obatched() class below
- int mhd_send_response(MHD_Connection* c) const {
+ MHD_RESULT mhd_send_response(MHD_Connection* c) const {
MHD_Response* r = MHD_create_response_from_buffer (message.size(),
(void*) message.c_str(),
MHD_RESPMEM_MUST_COPY);
MHD_add_response_header (r, "Content-Type", "text/plain");
- int rc = MHD_queue_response (c, code, r);
+ MHD_RESULT rc = MHD_queue_response (c, code, r);
MHD_destroy_response (r);
return rc;
}
@@ -1723,7 +1731,7 @@ handle_metrics (off_t* size)
/* libmicrohttpd callback */
-static int
+static MHD_RESULT
handler_cb (void * /*cls*/,
struct MHD_Connection *connection,
const char *url,
@@ -1736,7 +1744,11 @@ handler_cb (void * /*cls*/,
struct MHD_Response *r = NULL;
string url_copy = url;
+#if MHD_VERSION >= 0x00097002
+ enum MHD_Result rc;
+#else
int rc = MHD_NO; // mhd
+#endif
int http_code = 500;
off_t http_size = -1;
struct timeval tv_start, tv_end;