From 0b6423f9c99d9edf8c96fefd0f6c453859395aa1 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Mon, 30 Sep 2013 00:03:24 +0200 Subject: Import Nagios Plugins site Import the Nagios Plugins web site, Cronjobs, infrastructure scripts, and configuration files. --- web/attachments/280264-check_ups.diff | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 web/attachments/280264-check_ups.diff (limited to 'web/attachments/280264-check_ups.diff') 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 @@ +=== plugins/check_ups.c +================================================================== +--- plugins/check_ups.c (revision 2) ++++ plugins/check_ups.c (revision 4) +@@ -393,13 +393,13 @@ + /* char command[MAX_INPUT_BUFFER]; */ + char temp_buffer[MAX_INPUT_BUFFER]; + char send_buffer[MAX_INPUT_BUFFER]; +- char *ptr; ++ char *ptr, *end = NULL; + 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); ++ 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 +@@ -433,6 +433,9 @@ + } + + ptr = temp_buffer + strlen (varname) + strlen (ups_name) + 6; ++ end = strchr(ptr, '\n'); ++ if (end) ++ *end = 0; + len = strlen(ptr); + if (len < 2 || ptr[0] != '"' || ptr[len-1] != '"') { + printf ("%s\n", _("Error: unable to parse variable")); -- cgit v1.2.3-74-g34f1