mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-21 00:25:50 +00:00
Fix illegal division by zero. Upstream support seems abandoned, thus attaching patch to files/.
Approved by: wg (mentor)
This commit is contained in:
parent
e64bb3f555
commit
2c12f85bf0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=355946
@ -3,6 +3,7 @@
|
||||
|
||||
PORTNAME= sa-stats
|
||||
PORTVERSION= 1.0
|
||||
PORTREVISION= 1
|
||||
CATEGORIES= mail
|
||||
MASTER_SITES= http://www.rulesemporium.com/programs/ \
|
||||
ftp://renatasystems.org/pub/FreeBSD/ports/distfiles/
|
||||
|
20
mail/sa-stats/files/patch-za
Normal file
20
mail/sa-stats/files/patch-za
Normal file
@ -0,0 +1,20 @@
|
||||
--- sa-stats-1.0.txt 2014-05-09 07:43:35.000000000 +0200
|
||||
+++ sa-stats-1.0.txt 2014-05-24 08:00:28.000000000 +0200
|
||||
@@ -269,7 +269,7 @@ sub summarize {
|
||||
#my $perc1=sprintf("%.2f",($SPAM_RULES{$key}/$NUM_EMAIL)*100);
|
||||
my $perc1=sprintf("%.2f",(($SPAM_RULES{$key}+$HAM_RULES{$key})/$NUM_EMAIL)*100);
|
||||
my $perc2=sprintf("%.2f",($SPAM_RULES{$key}/$NUM_SPAM)*100);
|
||||
- my $perc3=sprintf("%.2f",($HAM_RULES{$key}/$NUM_HAM)*100);
|
||||
+ my $perc3=sprintf("%.2f",($NUM_HAM > 0 ? $HAM_RULES{$key}/$NUM_HAM : 0)*100);
|
||||
printf("%4d\t%-24s\t%5s\t%6.2f\t%6.2f\t%6.2f\n",$count+1,$key,$SPAM_RULES{$key},$perc1,$perc2,$perc3);
|
||||
$count++;
|
||||
if ($count >= $TOPRULES && $TOPRULES > 0) {
|
||||
@@ -289,7 +289,7 @@ sub summarize {
|
||||
foreach my $key (sort { $HAM_RULES{$b} <=> $HAM_RULES{$a} } keys %HAM_RULES) {
|
||||
#my $perc1=sprintf("%.2f",($HAM_RULES{$key}/$NUM_EMAIL)*100);
|
||||
my $perc1=sprintf("%.2f",(($SPAM_RULES{$key}+$HAM_RULES{$key})/$NUM_EMAIL)*100);
|
||||
- my $perc2=sprintf("%.2f",($SPAM_RULES{$key}/$NUM_SPAM)*100);
|
||||
+ my $perc2=sprintf("%.2f",($NUM_SPAM > 0 ? $SPAM_RULES{$key}/$NUM_SPAM : 0)*100);
|
||||
my $perc3=sprintf("%.2f",($HAM_RULES{$key}/$NUM_HAM)*100);
|
||||
printf("%4d\t%-24s\t%5s\t%6.2f\t%6.2f\t%6.2f\n",$count+1,$key,$HAM_RULES{$key},$perc1,$perc2,$perc3);
|
||||
$count++;
|
Loading…
Reference in New Issue
Block a user