I submitted an extended version of your patch last year (20/11/2007) for
inclusion, but it has never made it there.
Here it is again.
Kind regards,
--
Babar.
--- check_ups.c 2006-10-20 01:53:28.000000000 +0200
+++ check_ups.c.new 2007-11-07 00:02:02.000000000 +0100
@@ -397,12 +397,15 @@
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
@@ -414,6 +417,7 @@
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);