Просмотр исходного кода

check_snmp: Fix perfdata not adhering to plugin dev guidelines #293

Bryan Heden 8 лет назад
Родитель
Сommit
0861cc1a2e
2 измененных файлов с 7 добавлено и 0 удалено
  1. 1 0
      NEWS
  2. 6 0
      plugins/check_snmp.c

+ 1 - 0
NEWS

@@ -36,6 +36,7 @@ This file documents the major additions and syntax changes between releases.
 	Fix rpmbuild errors (Josh Coughlan)
 	check_ping: FreeBSD ping working natively
 	check_sensors: Fix fault test with --ignore-fault
+	check_snmp: Fix perfdata not adhering to plugin dev guidelines
 
 
 2.2.1 2017-04-19

+ 6 - 0
plugins/check_snmp.c

@@ -615,6 +615,12 @@ main (int argc, char **argv)
 				}
 				strncat(perfstr, ";", sizeof(perfstr)-strlen(perfstr)-1);
 			}
+
+			/* remove trailing semi-colons for guideline adherence */
+			if (perfstr[strlen(perfstr) - 1] == ';') {
+				perfstr[strlen(perfstr) - 1] = '\0';
+			}
+
 			strncat(perfstr, " ", sizeof(perfstr)-strlen(perfstr)-1);
 		}
 	}