From 48fab365920b153f4c6d36546205f03ca3d7cb4e Mon Sep 17 00:00:00 2001 From: laf Date: Tue, 8 Dec 2015 15:17:53 +0000 Subject: [PATCH] Check that $fields has value --- includes/rrdtool.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index c29d9bbc4f..9566497441 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -300,6 +300,7 @@ function rrdtool_escape($string, $maxlength=null){ } function rrdtool_tune($type, $filename, $max) { + $fields = array(); if ($type === 'port') { if ($max < 10000000) { return false; @@ -309,6 +310,8 @@ function rrdtool_tune($type, $filename, $max) { 'INOCTETS','OUTOCTETS','INERRORS','OUTERRORS','INUCASTPKTS','OUTUCASTPKTS','INNUCASTPKTS','OUTNUCASTPKTS','INDISCARDS','OUTDISCARDS','INUNKNOWNPROTOS','INBROADCASTPKTS','OUTBROADCASTPKTS','INMULTICASTPKTS','OUTMULTICASTPKTS' ); } - $options = "--maximum " . implode(":$max --maximum ", $fields). ":$max"; - rrdtool('tune', $filename, $options); + if (count($fields) > 0) { + $options = "--maximum " . implode(":$max --maximum ", $fields). ":$max"; + rrdtool('tune', $filename, $options); + } }