[Nagiosplug-checkins] CVS: nagiosplug/plugins check_snmp.c,1.8,1.9

Karl DeBisschop kdebisschop at users.sourceforge.net
Thu Nov 7 06:43:10 CET 2002


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory usw-pr-cvs1:/tmp/cvs-serv31367/plugins

Modified Files:
	check_snmp.c 
Log Message:
bugfixes to command format and (null) text created by asprintf switch

Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** check_snmp.c	21 Oct 2002 03:43:25 -0000	1.8
--- check_snmp.c	7 Nov 2002 14:30:08 -0000	1.9
***************
*** 156,160 ****
  char *server_address = NULL;
  char *community = NULL;
! char *oid = NULL;
  char *label = NULL;
  char *units = NULL;
--- 156,160 ----
  char *server_address = NULL;
  char *community = NULL;
! char *oid = "";
  char *label = NULL;
  char *units = NULL;
***************
*** 190,194 ****
  	char *command_line = NULL;
  	char *response = NULL;
! 	char *outbuff = NULL;
  	char *output = NULL;
  	char *ptr = NULL;
--- 190,194 ----
  	char *command_line = NULL;
  	char *response = NULL;
! 	char *outbuff = "";
  	char *output = NULL;
  	char *ptr = NULL;
***************
*** 198,202 ****
  	labels = malloc (labels_size);
  	unitv = malloc (unitv_size);
- 	outbuff = strscpy (outbuff, "");
  	for (i = 0; i < MAX_OIDS; i++)
  		eval_method[i] = CHECK_UNDEF;
--- 198,201 ----
***************
*** 207,212 ****
  
  	/* create the command line to execute */
! 	asprintf (&command_line, "%s -p %s -m ALL -v 1 %s -c %s %s",
! 	          PATH_TO_SNMPGET, port, server_address, community, oid);
  	if (verbose)
  		printf ("%s\n", command_line);
--- 206,211 ----
  
  	/* create the command line to execute */
! 	asprintf (&command_line, "%s -m ALL -v 1 -c %s %s:%s %s",
! 	          PATH_TO_SNMPGET, community, server_address, port, oid);
  	if (verbose)
  		printf ("%s\n", command_line);
***************
*** 369,375 ****
  
  	if (nunits > 0)
- 		printf ("%s %s -%s\n", label, state_text (result), outbuff);
- 	else
  		printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units);
  
  	return result;
--- 368,374 ----
  
  	if (nunits > 0)
  		printf ("%s %s -%s %s\n", label, state_text (result), outbuff, units);
+ 	else
+ 		printf ("%s %s -%s\n", label, state_text (result), outbuff);
  
  	return result;





More information about the Commits mailing list