]> dxcluster.org Git - spider.git/commitdiff
fix problems with empty/corrupt filters
authorminima <minima>
Mon, 9 Oct 2006 15:01:40 +0000 (15:01 +0000)
committerminima <minima>
Mon, 9 Oct 2006 15:01:40 +0000 (15:01 +0000)
Changes
perl/Filter.pm

diff --git a/Changes b/Changes
index 9e9106dc68990ea59c01f5134165cfcfcf7a0fb7..00e5fb9c8dac74cedf1de26810b2772b773c8588 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+09Oct06=======================================================================
+1. fix problems with bad filters pointed by Thomas DL3SBB.
 27Jul06=======================================================================
 1. merge in official issue version of wpxloc.raw (with one change: 4U1V).
 26Jul06=======================================================================
index a2f5ce46a7bac5f070e8531eaef59389e0f28b07..3009883b66f3a967665b46cc09e4b8310f5ff354 100644 (file)
@@ -116,17 +116,25 @@ sub read_in
                $in = undef; 
                my $s = readfilestr($fn);
                my $newin = eval $s;
-               dbg($@) if $@;
+               if ($@) {
+                       dbg($@);
+                       unlink($fn);
+                       return undef;
+               }
                if ($in) {
                        $newin = new('Filter::Old', $sort, $call, $flag);
                        $newin->{filter} = $in;
-               } else {
+               } elsif (ref $newin && $newin->can('getfilkeys')) {
                        my $filter;
                        my $key;
                        foreach $key ($newin->getfilkeys) {
                                $newin->compile($key, 'reject');
                                $newin->compile($key, 'accept');
                        }
+               } else {
+                       # error on reading file, delete and exit
+                       unlink($fn);
+                       return undef;
                }
                return $newin;
        }