[packages/cacti-plugin-thold] Division by zero error fix
jajcus
jajcus at pld-linux.org
Tue Dec 11 17:51:16 CET 2012
commit 1eb1be0db277bd408d1dcbcd5e504f7ae8c1bf96
Author: Jacek Konieczny <jajcus at jajcus.net>
Date: Tue Dec 11 17:50:10 2012 +0100
Division by zero error fix
The plugin would fail with:
> PHP Warning: Division by zero in /usr/share/cacti/plugins/thold/thold_functions.php on line 1590
when a baseline threshold was breached and no re-alert interval was
defined for that threshold.
cacti-plugin-thold-division_by_zero.patch | 12 ++++++++++++
cacti-plugin-thold.spec | 2 ++
2 files changed, 14 insertions(+)
---
diff --git a/cacti-plugin-thold.spec b/cacti-plugin-thold.spec
index 31c856a..f425ca5 100644
--- a/cacti-plugin-thold.spec
+++ b/cacti-plugin-thold.spec
@@ -11,6 +11,7 @@ Group: Applications/WWW
Source0: http://docs.cacti.net/_media/plugin:thold-v%{version}-3.tgz
# Source0-md5: 18fa28a60cafa0d9821fb5d9a8cf7823
Patch0: %{name}-undefined_variable_subject.patch
+Patch1: %{name}-division_by_zero.patch
URL: http://docs.cacti.net/plugin:thold
BuildRequires: rpm-php-pearprov >= 4.4.2-11
Requires: cacti
@@ -48,6 +49,7 @@ mv %{plugin}/{LICENSE,README} .
%{__rm} thold/includes/.settings.php.swp
%patch0 -p1
+%patch1 -p1
%install
rm -rf $RPM_BUILD_ROOT
diff --git a/cacti-plugin-thold-division_by_zero.patch b/cacti-plugin-thold-division_by_zero.patch
new file mode 100644
index 0000000..547ffbe
--- /dev/null
+++ b/cacti-plugin-thold-division_by_zero.patch
@@ -0,0 +1,12 @@
+diff -dur cacti-plugin-thold-0.4.9.orig/thold/thold_functions.php cacti-plugin-thold-0.4.9/thold/thold_functions.php
+--- cacti-plugin-thold-0.4.9.orig/thold/thold_functions.php 2012-12-11 17:47:07.000000000 +0100
++++ cacti-plugin-thold-0.4.9/thold/thold_functions.php 2012-12-11 17:48:34.789180077 +0100
+@@ -1587,7 +1587,7 @@
+ thold_debug('Threshold Baseline check breached');
+
+ /* re-alert? */
+- $ra = ($item['bl_fail_count'] > $bl_fail_trigger && ($item['bl_fail_count'] % ($item['repeat_alert'] == '' ? $realert : $item['repeat_alert'])) == 0);
++ $ra = ($item['bl_fail_count'] > $bl_fail_trigger && ($item['bl_fail_count'] % ($item['repeat_alert'] == 0 ? $realert : $item['repeat_alert'])) == 0);
+
+ $notify = ($item['bl_fail_count'] == $bl_fail_trigger || $ra);
+
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/cacti-plugin-thold.git/commitdiff/1eb1be0db277bd408d1dcbcd5e504f7ae8c1bf96
More information about the pld-cvs-commit
mailing list