From e7598ae6377659430f38a5360aeb09d8a26b8e1a Mon Sep 17 00:00:00 2001 From: Barak Shohat Date: Tue, 6 Apr 2021 16:35:20 +0300 Subject: Updated check_curl.c to display a specific human-readable error message where possible --- plugins/check_curl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins/check_curl.c') diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 9f1eafa2..ee9c8b1d 100644 --- a/plugins/check_curl.c +++ b/plugins/check_curl.c @@ -313,8 +313,8 @@ static char *string_statuscode (int major, int minor) /* assuming here HTTP/N with N>=4 */ snprintf (buf, sizeof (buf), "HTTP/%d", major); break; - } - + } + return buf; } @@ -662,7 +662,7 @@ check_http (void) /* Curl errors, result in critical Nagios state */ if (res != CURLE_OK) { snprintf (msg, DEFAULT_BUFFER_SIZE, _("Invalid HTTP response received from host on port %d: cURL returned %d - %s"), - server_port, res, curl_easy_strerror(res)); + server_port, res, errbuf[0] ? errbuf : curl_easy_strerror(res)); die (STATE_CRITICAL, "HTTP CRITICAL - %s\n", msg); } -- cgit v1.2.3-74-g34f1