summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Scherbaum <dertobi123@gentoo.org>2009-05-30 07:58:26 +0000
committerTobias Scherbaum <dertobi123@gentoo.org>2009-05-30 07:58:26 +0000
commita009411cdfc52df703f4296117025be811762985 (patch)
treeb6fbb22bf605d250714aaa94d0a759cdfa0e2dee /net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch
parentRemove app-text/tetex from dependencies, bug 227443. (diff)
downloadgentoo-2-a009411cdfc52df703f4296117025be811762985.tar.gz
gentoo-2-a009411cdfc52df703f4296117025be811762985.tar.bz2
gentoo-2-a009411cdfc52df703f4296117025be811762985.zip
Revbump, fix #243384 and #253893
(Portage version: 2.2_rc33/cvs/Linux x86_64)
Diffstat (limited to 'net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch')
-rw-r--r--net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch b/net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch
new file mode 100644
index 000000000000..7d100c2496dd
--- /dev/null
+++ b/net-analyzer/nagios-plugins/files/nagios-plugins-1.4.13-upslogout.patch
@@ -0,0 +1,29 @@
+diff --git a/plugins/check_ups.c b/plugins/check_ups.c
+index 154508d..bbd963a 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);