[Nagiosplug-checkins] nagiosplug/plugins check_snmp.c,1.66,1.67

Ton Voon tonvoon at users.sourceforge.net
Fri Oct 20 09:53:33 CEST 2006


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs7.sourceforge.net:/tmp/cvs-serv11387

Modified Files:
	check_snmp.c 
Log Message:
Reverting back accidently regressed code


Index: check_snmp.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_snmp.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -d -r1.66 -r1.67
--- check_snmp.c	19 Oct 2006 23:56:04 -0000	1.66
+++ check_snmp.c	20 Oct 2006 07:53:31 -0000	1.67
@@ -96,8 +96,8 @@
 regex_t preg;
 regmatch_t pmatch[10];
 char timestamp[10] = "";
-char errbuf[MAX_INPUT_BUFFER];
-char perfstr[MAX_INPUT_BUFFER];
+char errbuf[MAX_INPUT_BUFFER] = "";
+char perfstr[MAX_INPUT_BUFFER] = "";
 int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
 int eflags = 0;
 int errcode, excode;
@@ -154,8 +154,7 @@
 	char *ptr = NULL;
 	char *p2 = NULL;
 	char *show = NULL;
-	char type[8];
-	char *str[MAX_INPUT_BUFFER];
+	char type[8] = "";
 
 	setlocale (LC_ALL, "");
 	bindtextdomain (PACKAGE, LOCALEDIR);
@@ -257,6 +256,10 @@
 		}
 
 		/* We strip out the datatype indicator for PHBs */
+
+		/* Clean up type array - Sol10 does not necessarily zero it out */
+		bzero(type, sizeof(type));
+
 		if (strstr (response, "Gauge: "))
 			show = strstr (response, "Gauge: ") + 7;
 		else if (strstr (response, "Gauge32: "))
@@ -348,8 +351,11 @@
 
 		i++;
 
-		asprintf(str, "=%s%s;;;; ", show, type ? type : "");
-		strcat(perfstr, *str);
+		strcat(perfstr, "=");
+		strcat(perfstr, show);
+		if (type)
+			strcat(perfstr, type);
+		strcat(perfstr, " ");
 
 	}	/* end while (ptr) */
 





More information about the Commits mailing list