[Nagiosplug-checkins] CVS: nagiosplug/plugins check_dig.c,1.6,1.7

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Nov 21 04:42:03 CET 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv15918/plugins

Modified Files:
	check_dig.c 
Log Message:
fix empty output on errors

Index: check_dig.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_dig.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** check_dig.c	20 Nov 2002 11:28:50 -0000	1.6
--- check_dig.c	21 Nov 2002 12:40:58 -0000	1.7
***************
*** 89,97 ****
  
  			if (strstr (input_buffer, query_address) == input_buffer) {
! 				output = strscpy (output, input_buffer);
  				result = STATE_OK;
  			}
  			else {
! 				strscpy (output, "Server not found in ANSWER SECTION");
  				result = STATE_WARNING;
  			}
--- 89,97 ----
  
  			if (strstr (input_buffer, query_address) == input_buffer) {
! 				asprintf (&output, input_buffer);
  				result = STATE_OK;
  			}
  			else {
! 				asprintf (&output, "Server not found in ANSWER SECTION");
  				result = STATE_WARNING;
  			}
***************
*** 103,107 ****
  
  	if (result != STATE_OK) {
! 		strscpy (output, "No ANSWER SECTION found");
  	}
  
--- 103,107 ----
  
  	if (result != STATE_OK) {
! 		asprintf (&output, "No ANSWER SECTION found");
  	}
  
***************
*** 111,115 ****
  		printf ("%s", input_buffer);
  		if (strlen (output) == 0)
! 			strscpy (output, 1 + index (input_buffer, ':'));
  	}
  
--- 111,115 ----
  		printf ("%s", input_buffer);
  		if (strlen (output) == 0)
! 			asprintf (&output, 1 + index (input_buffer, ':'));
  	}
  
***************
*** 120,130 ****
  		result = max_state (result, STATE_WARNING);
  		if (strlen (output) == 0)
! 			strscpy (output, "dig returned error status");
  	}
  
  	(void) time (&end_time);
  
! 	if (output == NULL || strcmp (output, "") == 0 || strlen (output) == 0 || strspn (output, " \t\r\n") == strlen (output))
! 		strscpy (output, " Probably a non-existent host/domain");
  
  	if (result == STATE_OK)
--- 120,130 ----
  		result = max_state (result, STATE_WARNING);
  		if (strlen (output) == 0)
! 			asprintf (&output, "dig returned error status");
  	}
  
  	(void) time (&end_time);
  
! 	if (output == NULL || strlen (output) == 0)
! 		asprintf (&output, " Probably a non-existent host/domain");
  
  	if (result == STATE_OK)
***************
*** 217,221 ****
  		}
  		else {
! 			dns_server = strscpy (NULL, "127.0.0.1");
  		}
  	}
--- 217,221 ----
  		}
  		else {
! 			asprintf (&dns_server, "127.0.0.1");
  		}
  	}





More information about the Commits mailing list