summaryrefslogtreecommitdiffstats
path: root/web/attachments/280264-check_ups.diff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2013-09-29 22:03:24 (GMT)
committerHolger Weiss <holger@zedat.fu-berlin.de>2013-09-29 22:03:24 (GMT)
commit0b6423f9c99d9edf8c96fefd0f6c453859395aa1 (patch)
tree1c2b6b21704a294940f87c7892676998d8371707 /web/attachments/280264-check_ups.diff
downloadsite-0b6423f9c99d9edf8c96fefd0f6c453859395aa1.tar.gz
Import Nagios Plugins site
Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files.
Diffstat (limited to 'web/attachments/280264-check_ups.diff')
-rw-r--r--web/attachments/280264-check_ups.diff30
1 files changed, 30 insertions, 0 deletions
diff --git a/web/attachments/280264-check_ups.diff b/web/attachments/280264-check_ups.diff
new file mode 100644
index 0000000..595353e
--- /dev/null
+++ b/web/attachments/280264-check_ups.diff
@@ -0,0 +1,30 @@
1=== plugins/check_ups.c
2==================================================================
3--- plugins/check_ups.c (revision 2)
4+++ plugins/check_ups.c (revision 4)
5@@ -393,13 +393,13 @@
6 /* char command[MAX_INPUT_BUFFER]; */
7 char temp_buffer[MAX_INPUT_BUFFER];
8 char send_buffer[MAX_INPUT_BUFFER];
9- char *ptr;
10+ char *ptr, *end = NULL;
11 int len;
12
13 *buf=0;
14
15 /* create the command string to send to the UPS daemon */
16- sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
17+ sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
18
19 /* send the command to the daemon and get a response back */
20 if (process_tcp_request
21@@ -433,6 +433,9 @@
22 }
23
24 ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6;
25+ end = strchr(ptr, '\n');
26+ if (end)
27+ *end = 0;
28 len = strlen(ptr);
29 if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') {
30 printf ("%s\n", _("Error: unable to parse variable"));