moan about and then delete empty message files
authorminima <minima>
Fri, 25 Aug 2000 21:03:07 +0000 (21:03 +0000)
committerminima <minima>
Fri, 25 Aug 2000 21:03:07 +0000 (21:03 +0000)
Changes
perl/DXMsg.pm

diff --git a/Changes b/Changes
index 813b28a03dc695a4b65ef684abceb8198d862229..cb438c688cc228fc8c0c8165f80763e85110b8a8 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,5 @@
+25Aug00=======================================================================
+1. moan about and then delete empty message files
 24Aug00=======================================================================
 1. Removed WWV command so that users can't interfere (read mess up) the
 automatic feeds which come from various places on the net.
index 5c990177330ddc26c55fd20ccd7a0fcf242e49b1..879775f3596f9f08bb9afa0f1ffb605100412938 100644 (file)
@@ -512,6 +512,11 @@ sub read_msg_header
        }
        $size = -s $fn;
        $line = <$file>;                        # first line
+       if ($size == 0 || !$line) {
+           dbg('err', "Empty $fn $!");
+           Log('err', "Empty $fn $!");
+               return undef;
+       }
        chomp $line;
        $size -= length $line;
        if (! $line =~ /^===/o) {
@@ -758,7 +763,12 @@ sub init
                next unless /^m\d+$/o;
                
                $ref = read_msg_header("$msgdir/$_");
-               next unless $ref;
+               unless ($ref) {
+                       dbg('err', "Deleting $_");
+                       Log('err', "Deleting $_");
+                       unlink "$msgdir/$_";
+                       next;
+               }
                
                # delete any messages to 'badmsg.pl' places
                if (grep $ref->{to} eq $_, @badmsg) {