Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 243384
Collapse All | Expand All

(-)plugins/check_ups.c.orig (-3 / +6 lines)
Lines 397-409 Link Here
397
	/*  char command[MAX_INPUT_BUFFER]; */
397
	/*  char command[MAX_INPUT_BUFFER]; */
398
	char temp_buffer[MAX_INPUT_BUFFER];
398
	char temp_buffer[MAX_INPUT_BUFFER];
399
	char send_buffer[MAX_INPUT_BUFFER];
399
	char send_buffer[MAX_INPUT_BUFFER];
400
	char *ptr;
400
	char *ptr, *end = NULL;
401
	int len;
401
	int len;
402
402
403
	*buf=0;
403
	*buf=0;
404
	
404
	
405
	/* create the command string to send to the UPS daemon */
405
	/* create the command string to send to the UPS daemon */
406
	sprintf (send_buffer, "GET VAR %s %s\n", ups_name, varname);
406
	sprintf (send_buffer, "GET VAR %s %s\nLOGOUT\n", ups_name, varname);
407
407
408
	/* send the command to the daemon and get a response back */
408
	/* send the command to the daemon and get a response back */
409
	if (process_tcp_request
409
	if (process_tcp_request
Lines 414-421 Link Here
414
	}
414
	}
415
415
416
	ptr = temp_buffer;
416
	ptr = temp_buffer;
417
	end = strchr(ptr, '\n');
418
	if (end) 
419
		*end = 0;
417
	len = strlen(ptr);
420
	len = strlen(ptr);
418
	if (len > 0 && ptr[len-1] == '\n') ptr[len-1]=0;
421
419
	if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
422
	if (strcmp (ptr, "ERR UNKNOWN-UPS") == 0) {
420
		printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);
423
		printf (_("CRITICAL - no such ups '%s' on that host\n"), ups_name);
421
		return ERROR;
424
		return ERROR;

Return to bug 243384