aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--THANKS.in2
-rw-r--r--plugins/check_ups.c6
3 files changed, 8 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index e5c7d11e..01567017 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,7 @@ This file documents the major additions and syntax changes between releases.
Updated tinderbox_build script to point to new tinderbox server
check_ifoperstatus -n flag now works as expected (sf.net #1569488)
check_ifoperstatus now supports ifType based lookup for ifIndex
+ check_ups now sends a LOGOUT string (debian bug #387001)
1.4.13 25th Sept 2008
Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/THANKS.in b/THANKS.in
index a003fa81..80fa47a3 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -238,3 +238,5 @@ Rob Windsor
Hilko Bengen
Sven Nierlein
Erik Wasser
+Tilman Koschnick
+Olivier 'Babar' Raginel
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 154508db..bbd963a9 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -398,12 +398,15 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
char temp_buffer[MAX_INPUT_BUFFER];
char send_buffer[MAX_INPUT_BUFFER];
char *ptr;
+ char *logout = "OK Goodbye\n";
+ int logout_len = strlen(logout);
int len;
*buf=0;
/* create the command string to send to the UPS daemon */
- sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
+ /* Add LOGOUT to avoid read failure logs */
+ sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
/* send the command to the daemon and get a response back */
if (process_tcp_request
@@ -415,6 +418,7 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
ptr = temp_buffer;
len = strlen(ptr);
+ if (len > logout_len && strcmp (ptr + len - logout_len, logout) == 0) len -= logout_len;
if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);