From ceb614aad46423170e284e66023c7a2e8c513338 Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Sun, 15 Oct 2023 19:10:43 +0200 Subject: fix compiler warnings for unused variables --- plugins/check_curl.c | 14 ++++++++++++-- plugins/check_ldap.c | 3 --- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/check_curl.c b/plugins/check_curl.c index da578b55..153e492f 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -1218,6 +1218,10 @@ redir (curlhelp_write_curlbuf* header_buf) &status_line.http_major, &status_line.http_minor, &status_line.http_code, &status_line.msg, &msglen, headers, &nof_headers, 0); + if (res == -1) { + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Failed to parse Response\n")); + } + location = get_header_value (headers, nof_headers, "location"); if (verbose >= 2) @@ -2388,6 +2392,10 @@ check_document_dates (const curlhelp_write_curlbuf *header_buf, char (*msg)[DEFA &status_line.http_major, &status_line.http_minor, &status_line.http_code, &status_line.msg, &msglen, headers, &nof_headers, 0); + if (res == -1) { + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Failed to parse Response\n")); + } + server_date = get_header_value (headers, nof_headers, "date"); document_date = get_header_value (headers, nof_headers, "last-modified"); @@ -2463,9 +2471,7 @@ check_document_dates (const curlhelp_write_curlbuf *header_buf, char (*msg)[DEFA int get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_write_curlbuf* body_buf) { - const char *s; int content_length = 0; - char *copy; struct phr_header headers[255]; size_t nof_headers = 255; size_t msglen; @@ -2476,6 +2482,10 @@ get_content_length (const curlhelp_write_curlbuf* header_buf, const curlhelp_wri &status_line.http_major, &status_line.http_minor, &status_line.http_code, &status_line.msg, &msglen, headers, &nof_headers, 0); + if (res == -1) { + die (STATE_UNKNOWN, _("HTTP UNKNOWN - Failed to parse Response\n")); + } + content_length_s = get_header_value (headers, nof_headers, "content-length"); if (!content_length_s) { return header_buf->buflen + body_buf->buflen; diff --git a/plugins/check_ldap.c b/plugins/check_ldap.c index a1bfe1be..15113b1f 100644 --- a/plugins/check_ldap.c +++ b/plugins/check_ldap.c @@ -97,9 +97,6 @@ main (int argc, char *argv[]) int tls; int version=3; - /* for entry counting */ - - LDAPMessage *next_entry; int status_entries = STATE_OK; int num_entries = 0; -- cgit v1.2.3-74-g34f1