diff options
author | Barak Shohat <barak@bazzisoft.com> | 2021-04-06 16:35:20 +0300 |
---|---|---|
committer | Barak Shohat <barak@bazzisoft.com> | 2021-04-07 12:36:55 +0300 |
commit | 2482950e267a752b37d696c10ea091dc62d6d8a7 (patch) | |
tree | 4d83308070e360cad99a21537337a9d8f01ae14e /plugins/check_curl.c | |
parent | 57b4dc0f2307cd49bedeed01ee56bc6077d428f5 (diff) | |
download | monitoring-plugins-2482950e267a752b37d696c10ea091dc62d6d8a7.tar.gz |
Updated check_curl.c to display a specific human-readable error message where possible
Diffstat (limited to 'plugins/check_curl.c')
-rw-r--r-- | plugins/check_curl.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c index 8f274c26..8cb2ff49 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); } |