diff options
Diffstat (limited to 'web/attachments/280264-check_ups.diff')
-rw-r--r-- | web/attachments/280264-check_ups.diff | 30 |
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")); | ||