From 70b519bb270268a438d01c298f3e1a35038a0a72 Mon Sep 17 00:00:00 2001 From: Ton Voon Date: Fri, 20 Oct 2006 07:53:31 +0000 Subject: [PATCH] Reverting back accidently regressed code git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1513 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/check_snmp.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 7ba9684..1e1657b 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -96,8 +96,8 @@ char regex_expect[MAX_INPUT_BUFFER] = ""; 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 @@ main (int argc, char **argv) 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 @@ main (int argc, char **argv) } /* 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 @@ main (int argc, char **argv) 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) */ -- 2.30.2