From 6ed7a75c3b4565af54b8fd4d96225a36a705a0fd Mon Sep 17 00:00:00 2001 From: RincewindsHat <12514511+RincewindsHat@users.noreply.github.com> Date: Thu, 22 Dec 2022 13:16:19 +0100 Subject: Reformat a part to increase readability --- plugins/check_http.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/plugins/check_http.c b/plugins/check_http.c index dbaa0d78..a9c22389 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c @@ -1246,13 +1246,23 @@ check_http (void) if (strstr(header, header_expect) == NULL) { // We did not find the header, the rest is for building the output and setting the state char output_header_search[30] = ""; + strncpy(&output_header_search[0], header_expect, sizeof(output_header_search)); + if (output_header_search[sizeof(output_header_search) - 1] != '\0') { - bcopy("...", &output_header_search[sizeof(output_header_search) - 4], - 4); + bcopy("...", + &output_header_search[sizeof(output_header_search) - 4], + 4); } - xasprintf (&msg, _("%sheader '%s' not found on '%s://%s:%d%s', "), msg, output_header_search, use_ssl ? "https" : "http", host_name ? host_name : server_address, server_port, server_url); + + xasprintf (&msg, + _("%sheader '%s' not found on '%s://%s:%d%s', "), + msg, + output_header_search, use_ssl ? "https" : "http", + host_name ? host_name : server_address, server_port, + server_url); + result = STATE_CRITICAL; } } -- cgit v1.2.3-74-g34f1