diff options
author | alexey <alexey@FreeBSD.org> | 2014-05-31 16:37:18 +0800 |
---|---|---|
committer | alexey <alexey@FreeBSD.org> | 2014-05-31 16:37:18 +0800 |
commit | 5a0debe6d83f3c06eeb4a7091540dbc3d8b73e6e (patch) | |
tree | 56f18e08a944a99f74d57aaec28075c52e962097 /mail | |
parent | 02711cb109add1f246690547303d6d04dee4e450 (diff) | |
download | freebsd-ports-gnome-5a0debe6d83f3c06eeb4a7091540dbc3d8b73e6e.tar.gz freebsd-ports-gnome-5a0debe6d83f3c06eeb4a7091540dbc3d8b73e6e.tar.zst freebsd-ports-gnome-5a0debe6d83f3c06eeb4a7091540dbc3d8b73e6e.zip |
Fix illegal division by zero. Upstream support seems abandoned, thus attaching patch to files/.
Approved by: wg (mentor)
Diffstat (limited to 'mail')
-rw-r--r-- | mail/sa-stats/Makefile | 1 | ||||
-rw-r--r-- | mail/sa-stats/files/patch-za | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/mail/sa-stats/Makefile b/mail/sa-stats/Makefile index 1fe0700160b8..268e606bb76c 100644 --- a/mail/sa-stats/Makefile +++ b/mail/sa-stats/Makefile @@ -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/ diff --git a/mail/sa-stats/files/patch-za b/mail/sa-stats/files/patch-za new file mode 100644 index 000000000000..f6ad8bbfbaa7 --- /dev/null +++ b/mail/sa-stats/files/patch-za @@ -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++; |